<div>
<div id="select-html">
	<style>
		table .td5{ width: 15%;}
	</style>
    <section class="select-menu">

		<div class="titles fiex" style="position: relative;">
			<div class="black"><a href="#!root-html" ><svg class="g2" ><use xlink:href="#f_black"></use></svg></a></div>
			<div class="fiex1 f-30 ellipsis "><span data-l="1050"></span> <span  class="title1"></span></div>
			<div class="fiex1 set-jianpan">
         		<input class="search-top" id="search-top" type="search" oncomplete data-p="1128"  />
            </div>
		</div>
		
        <div class="menu-btm" style="background: #f6f7f8;">
            <div class="menu-btm-box">
            	<div class="caipu_top_box">
            		<div class="caipu_top f-28" id="caipu_top"></div>    
            	</div>
            	<script id="menu-top" type="text/html">
            		{{each list as v i}}
            			<a href="javascript:;" id="caipu_{{v.id}}" {{if v.id==cur}}class="on"{{/if}} data-cookbook={{v.id}} >{{v.cookbook_name}}<i></i></a> 
            		{{/each}}
            	</script>
                <div class="menu-left" id="menu-left" style="top: 0.8rem;"></div>
                <script id="menu-left-js" type="text/html">
                    <ul>
                        {{each list as v i}}
                        	{{if v.hide!=1 && v.lefttime!=0}}
	                        <li id="menuleft-{{v.id}}" data-id="{{v.id}}"><i></i>
	                        	<span>
	                        	{{if v.id==1 || v.id==2}}<svg class="g1"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#f_6"></use></svg>{{/if}}
	                        	{{v.goods_cate_name}}
	                        	
	                        	</span></li>
	                       {{/if}}
                        {{/each}}
                    </ul>
                    
                    <div class="bank100"></div>
                </script>

                <div class="menu-right" id="menu-right"></div>
				<i class="prve qiehua" id="qiehuan_prve"><em class="mag-r-10 e">&nbsp;</em><em class="f-24">PREV</em> <u class="f-24">TOP</u></i>
                <i class="next qiehua" id="qiehuan_next"><em class="mag-r-10 e">&nbsp;</em><em class="f-24">NEXT</em> <u class="f-24">END</u></i>

                <script type="text/html" id="menu-right-js">
                	
                	<div id="menu-right-w">
                	<div>
                    {{each list as v i}}
                    <div class="box" style="display: none;"  id="main-right-box-{{v.id}}"  data-id="{{v.id}}">
                        <div class="tit">{{v.goods_cate_name}}</div>
                        <div class="group">                            
                            {{each v.goods_list as vv ii}}
                                {{if vv.status==1 && vv.hide!=1 && vv.lefttime==1 && vv.status!='99'}}
                                
                               <!-- 设置原始单价-->
                             <div class="item {{if menu==0}}disable{{/if}}  item-{{vv.id}}" data-parentindex="{{i}}" data-index="{{ii}}" data-parent-id="{{vv.goods_cate_id}}" data-id="{{vv.id}}" data-num="0" {{if vv.goods_price_d}} data-price="{{vv.goods_price_d}}"  {{else}} data-price="{{vv.goods_price}}"  {{/if}} data-goodsspecid="{{vv.goods_spec_id}}">
                                
                                <!--<div class="item {{if menu==0}}disable{{/if}}  item-{{vv.id}}" data-parent-id="{{vv.goods_cate_id}}" data-id="{{vv.id}}" data-num="0"  data-price="{{vv.goods_price}}"  data-goodsspecid="{{vv.goods_spec_id}}">-->
                                    <div class="w cf">
                                    	{{if vv.goods_thumb!=""}}
        <!--                            	<div class="fl"><img class="lazy" originalsrc="{{vv.goods_thumb}}" /></div>-->
                                        <div class="fl"><img style="background: url({{oss}}/Public/Upload/image/{{vv.goods_thumb}}?x-oss-process=image/resize,m_fill,h_150,w_150) no-repeat center; background-size: cover;"  src="../images/null.gif" /></div>
                                        {{/if}}
                                        <div class="oh">
                                            <div class="t1 ">
                                            	<span>{{vv.goods_name}}</span>
                                            	<span class="tag">
                                            		{{each vv.food_tag_type as vv ii}}
                                            			<i class="k{{vv}}"></i>
                                            		{{/each}}
                                            	</span>
                                            </div>                                         
                                            <div class="t3 cf">
                                            	
                                                <div class=" f-30"><span class="oh">{{vv.goods_price}}</span>{{if vv.goods_unit}}<span class="r c666">/{{vv.goods_unit}}</span>{{/if}}</div>  
                                            </div>
                                        </div>
                                    </div>                                   
                                    
                                    <!--判断是否套餐展示-->
                                    {{if vv.is_package_goods==1}}<!--父级索引等于2就是套餐-->
                                    <div class="addright cf spec taocan" data-parent-id="{{vv.goods_cate_id}}" data-id="{{vv.id}}" data-num="0" data-price="{{vv.goods_price}}" >
                                        <div class="p p1 null">
                                        	<em class="specem" data-l="1054"></em>
                                        	<i></i><svg class="g1" ><use xlink:href="#f_4"></use></svg></div>
                                        <span class="g3">0</span>
                                        <div class="p p2 addgwc"><i></i><svg class="g2" ><use xlink:href="#f_5"></use></svg></div>
                                    </div>
                                    {{else}}
                                    <div class="addright cf spec {{if !vv.garnish_list[0]}}{{if !vv.spec_list[0]}}{{if !vv.taste_list[0]}}{{if vv.is_prompt!=1}}nullspec{{/if}}{{/if}}{{/if}}{{/if}}" data-parent-id="{{vv.goods_cate_id}}" data-id="{{vv.id}}" data-num="0" data-price="{{vv.goods_price}}" {{each vv.spec_list as ss nn}} data-{{ss.goods_spec_id}}="0"{{/each}} >
                                        <div class="p p1 {{if vv.garnish_list[0] || vv.spec_list[0] || vv.taste_list[0]}}null{{/if}}">
                                        	<em class="specem" data-l="1054"></em>
                                        	<i></i><svg class="g1" ><use xlink:href="#f_4"></use></svg></div>
                                        <span class="g3">0</span>
                                        <div class="p p2 addgwc"><i></i><svg class="g2" ><use xlink:href="#f_5"></use></svg></div>
                                    </div>
                                   {{/if}}
                                </div>
                                {{/if}}
                            {{/each}}  
                            
                            
                             {{each v.goods_list as vv ii}}
                                {{if vv.status==2 && vv.hide!=1 && vv.lefttime==1 && vv.status!='99'}}
                                
                               <!-- 估清菜品-->
                             <div class="item disable  item-{{vv.id}}" data-parent-id="{{vv.goods_cate_id}}" data-id="{{vv.id}}" data-num="0" {{if vv.goods_price_d}} data-price="{{vv.goods_price_d}}"  {{else}} data-price="{{vv.goods_price}}"  {{/if}} data-goodsspecid="{{vv.goods_spec_id}}">
                                
                                    <div class="w cf">
                                    	{{if vv.goods_thumb!=""}}
    
                                        <div class="fl"><img style="background: url({{oss}}/Public/Upload/image/{{vv.goods_thumb}}?x-oss-process=image/resize,m_fill,h_150,w_150) no-repeat center; background-size: cover;"  src="../images/null.gif" /></div>
                                        {{/if}}
                                        <div class="oh">
                                            <div class="t1 ">
                                            	<span>{{vv.goods_name}}</span>
                                            	<span class="tag">
                                            		{{each vv.food_tag_type as vv ii}}
                                            			<i class="k{{vv}}"></i>
                                            		{{/each}}
                                            	</span>
                                            </div>                                         
                                            <div class="t3 cf">
                                            	
                                                <div class=" f-30"><span class="oh">{{vv.goods_price}}</span>{{if vv.goods_unit}}<span class="r c666">/{{vv.goods_unit}}</span>{{/if}}</div>  
                                            </div>
                                        </div>
                                    </div>                                   
                                    <div class="addright f-right c999" style="display: block;">
                                    	{{shouqin.k1}}
                                    </div>
                                </div>
                                {{/if}}
                            {{/each}}  
                            
                        </div>
                    </div>
                    {{/each}}
                    <div id="nulldata" class="nulldata f-30 center mag-t-30" data-l="1129" style="display: none;"></div>
                    </div>                
                    <div class="bank100"></div>
                   	</div>
                </script>

            </div>
        </div>

        <div class="select-buy" id="select-buy" >
             <div class="right">
             	<a href="javascript:;" id="xuanhaole" data-l="1004"></a>
            	<a href="javascript:;" id="xiachu" data-l="1026"></a>
             </div>
            <div class="left cf">
                <div class="gw" id="icon_gw"><i></i><em style="display: none;"></em>
                    <svg class="g1" ><use xlink:href="#f_7"></use></svg>
                </div>
                <div class="sum" id="total_price" data-price=""><span></span></div>
            </div> 
            <div class="carbuy">
                <div class="car-tit cf">
                	<a href="javascript:;" class="back">
                		<svg class="g2"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#f_10"></use></svg>
                	</a>
                    <div class="fl pad-l-50"><span data-l="1005"></span></div>
                    <div class="fr"> <svg class="g1" ><use xlink:href="#f_8"></use></svg><span data-l="1006"></span></div>
                </div>
                <div class="car-box ">
                    
 					<div class="order-tab-head s2 mag-l-20 mag-r-20 pad-t-20">
			        	<table>
			        		<tr>
			        			<td class="td1"><div class="w">.No</div></td>
			        			<td class="td2"><div class="w" data-l="1063"></div></td>
			        			<td class="td3"><div class="w" data-l="1064"></div></td>
			        			<td class="td4"><div class="w" data-l="1065"></div></td>
				        		<td class="td5"><div class="w" data-l="1066"></div></td>
			        		</tr>
			        	</table>
			        </div>
                    <div class="my-list" id="my-list"></div>
                    
                      <div class="pad-20" style="padding-top: 0;">
                	  <dl class="dl mag-t-10  guige-box4 beizhu-bon">
						<dt class="mag-b-10 c999 fiex">
							
							<div class="fiex1  fiex">
								<div class="fiex1" data-l="1021"></div> 
								<div  class="fiex3" id="beizhu_p"></div>
							</div>
							<div class="fr f-right ">
								<svg class="g2" ><use xlink:href="#f_5"></use></svg>
							</div>
						</dt>
					</dl>
                    	
               		<div class="line-ddd"></div>
						
						<dl class="dl pad-t-10  guige-box5">
							<dt class="mag-b-10 c999 fiex">
								<div class="fiex1 f-28"><span data-l="1196"></span></div>
								<div class=" f-right">
									<div class="weui-cell" style="padding: 0;">
								        <div class="weui-cell__ft">
								          <input class="weui-switch beizhu-open" id="other_set0_2" style="vertical-align: top;" type="checkbox">
								        </div>
								      </div>
								</div>
							</dt>
						</dl>

                    </div>
                    
                    <div class="other-list" id="other-list" style="display: none;"></div>
                    
                  
                </div>
            </div>  
        </div>
         <div class="select-buy center fiex " id="select-buy1" style="background: #999; display: none;">
         	<p style=" color: #fff;" class="fiex1"></p>
         </div>
		
		<script type="text/html" id="select-buy-js1">
			{{if my_number}}				
                {{each my_list as v i}}
                	{{if i==member_id}}
                	{{if i!=""}}<div class="n user cf" style="display: none;">
                		<div class="fl red"><span data-l="1007"></span> </div>
                		<div class="fr"><span data-l="1061"></span> {{i}}</div>
                	</div>{{/if}}
                	<div class="car-ul order-art-list" style="padding-top: 0;">
                	{{each v as vv ii}}                	
                    {{if vv.status==1}}                    	
                        <div class="item-l" id="item-l-{{vv.cart_id}}" data-goods_id="{{vv.goods_id}}" data-cart_id="{{vv.cart_id}}" {{if setmenumore!="1" && vv.cookbook!=curcookbook}} style="display: none;"{{/if}}>
				                <table>   
				                   <tr class="item f-28">
				            	<td class="td1" {{if vv.remarks}}rowspan="2"{{/if}}><div class="w center">{{ii+1}}</div></td>
				    			<td class="td2">
				    				<div class="w ">
										<span>{{vv.goods_name}} </span>
					                	{{if vv.goods_spec_name}}<span class="c999">[{{vv.goods_spec_name}}]</span>{{/if}}
					                	{{if vv.goods_taste_name}}<span class="c999">[{{vv.goods_taste_name}}]</span>{{/if}} 
										{{each vv.garnish_ids as vvv iii}}
					                    	<div class="clear"></div>
					                    	<div class="mag-l-15 f-22 c999 {{if iii==0}}mag-t-5{{/if}}">
					                        	{{vvv.goods_garnish_name}}
						                        <span class="red">x{{vvv.count}}</span>	
					                    	</div>
					                    {{/each}}	
					                    
					                    
					                     {{if vv.is_package_goods=="1"}}
											<div class="package " >
											{{each vv.package_cate_list as pack_v pack_i}}
											    <dl class="f-24 cf mag-t-5">
												<dt class="c999  f-right"  >{{pack_v.name}}</dt>
												<dd class="oh" >
												{{each vv.package_goods_list as pack_vv pack_ii}}
													{{if pack_v.id == pack_vv.cate_id}}
														<div>
														<p class="pad-l-10">
															{{caidan_json[pack_vv.goods_id].goods_name}}
															{{if pack_vv.spec_id!='0' && pack_vv.spec_id}}
															<span class="c999">[{{guige1_json[pack_vv.spec_id].goods_spec_name}}]</span>
															{{/if}}
															{{if pack_vv.taste_id!='0' && pack_vv.taste_id}}
															<span class="c999">[{{kouwei1_json[pack_vv.taste_id].goods_taste_name}}]</span>
															{{/if}}
															<span class="red"><i class="f-20">x</i> {{pack_vv.count}}</span>
														</p>
														{{each pack_vv.garnish_ids as pack_vvv pack_iii}}
															<p class="pad-l-20 f-10 c999 f-20">{{peicai_json[pack_vvv.garnish_id].goods_garnish_name}} x {{pack_vvv.count}}</p>
														{{/each}}
														</div>
													{{/if}}
													
												{{/each}}
												</dd>
												</dl>
											{{/each}}
											</div>
										{{/if}}
					                    
					    			</div>
				    			</td>
				    			<td class="td3"><div class="w center bon">
				    				<div class="addright cf" data-parent-id="{{vv.goods_cate_id}}"  data-cart_id="{{vv.cart_id}}" data-id="{{vv.goods_id}}" data-num="{{vv.count}}" data-price="{{vv.goods_price}}" data-specid="{{vv.spec_id}}" data-goodsspecid="{{vv.goods_spec_id}}">
				                                <div class="p p1"><i></i><svg class="g1" ><use xlink:href="#f_4"></use></svg></div>
				                                <span class="g3  red">{{vv.count}}</span>
				                                <div class="p p2"><i></i><svg class="g2" ><use xlink:href="#f_5"></use></svg></div>
				                            </div>
				    			</div></td>
				    			<td class="td4"><div class="w center red">{{vv.total_price}}</div></td>
				    			<td class="td5 {{if vv.is_pack==1}}on{{/if}}"><div class="w pak">				    				
				    				<svg class="g1" ><use xlink:href="#f_11"></use></svg>
				    			</div></td>
				            </tr>
				            		{{if vv.remarks}}
				        			<tr>
				        				<td colspan="3"><div class="w aaa">{{vv.remarks}}</div></td>        				
				        			</tr>
				        			{{/if}}
				                         </table>   
				                         <div class="bottoms" data-parent-id="{{vv.goods_cate_id}}"  data-cart_id="{{vv.cart_id}}" data-id="{{vv.goods_id}}" data-num="1" data-name="{{vv.goods_name}}"  data-price="{{vv.goods_price}}" data-specid="{{vv.spec_id}}" data-goodsspecid="{{vv.goods_spec_id}}">
				                         
				                         </div>
				                 </div>
                    {{/if}}
                    {{/each}}
                    </div>
                    {{/if}}
                {{/each}}
            {{else}}
                <div class="nodata lang"  ><span data-l="1009"></span></div>
            {{/if}}
		</script>
		<script type="text/html" id="select-buy-js2">
			{{if th_number}} 
                {{each my_list as v i}}
                	{{if i!=member_id}}
                	{{if i!=""}}<div class="n user cf" style="display: none;">
                		<div class="fl green"><span data-l="1008"></span> </div>
                		<div class="fr"><span data-l="1061"></span> {{i}}</div>
                	</div>{{/if}}
                	<div class="car-ul order-art-list" style="padding-top: 0;">
                	{{each v as vv ii}}                	
	                    {{if vv.status==1}}                    	
	                        <div class="item-l f-24" id="item-l-{{vv.cart_id}}" data-goods_id="{{vv.goods_id}}" data-cart_id="{{vv.cart_id}}">
				                <table>   
				                   <tr class="item">
				            	<td class="td1" {{if vv.remarks}}rowspan="2"{{/if}}><div class="w center">{{ii+1}}</div></td>
				    			<td class="td2">
				    				<div class="w ">
										<span>{{vv.goods_name}} </span>
					                	{{if vv.goods_spec_name}}<span class="c999">[{{vv.goods_spec_name}}]</span>{{/if}}
					                	{{if vv.goods_taste_name}}<span class="c999">[{{vv.goods_taste_name}}]</span>{{/if}} 
									   {{each vv.garnish_ids as vvv iii}}
					                    	<div class="clear"></div>
					                    	<div class="mag-l-15 f-22 c999 {{if iii==0}}mag-t-5{{/if}}">
					                        	{{vvv.goods_garnish_name}}
						                        <span class="red">x{{vvv.count}}</span>	
					                    	</div>
					                    {{/each}}	            			
					    			</div>
				    			</td>
				    			<td class="td3"><div class="w center bon">
				    				<div class="addright cf" data-parent-id="{{vv.goods_cate_id}}"  data-cart_id="{{vv.cart_id}}" data-id="{{vv.goods_id}}" data-num="{{vv.count}}" data-price="{{vv.goods_price}}" data-specid="{{vv.spec_id}}" data-goodsspecid="{{vv.goods_spec_id}}">
				                                <div class="p p1 disable" style="opacity: 0.0;"><i></i><svg class="g1" style="fill: #333;" ><use xlink:href="#f_4"></use></svg></div>
				                                <span class="g3  red">{{vv.count}}</span>
				                                <div class="p p2 disable" style="opacity: 0.0;"><i></i><svg class="g2" ><use xlink:href="#f_5"></use></svg></div>
				                            </div>
				    			</div></td>
				    			<td class="td4"><div class="w center red">{{vv.total_price}}</div></td>
				    			<td class="td5"><div class="w pak">&nbsp;</div></td>
				            </tr>
				            		{{if vv.remarks}}
				        			<tr>
				        				<td colspan="3"><div class="w aaa">{{vv.remarks}}</div></td>        				
				        			</tr>
				        			{{/if}}
				                         </table>   
				                         <div class="bottoms" data-parent-id="{{vv.goods_cate_id}}"  data-cart_id="{{vv.cart_id}}" data-id="{{vv.goods_id}}" data-num="1" data-name="{{vv.goods_name}}"  data-price="{{vv.goods_price}}" data-specid="{{vv.spec_id}}" data-goodsspecid="{{vv.goods_spec_id}}">
				                         
				                         </div>
				                 </div>
	                    {{/if}}
                    {{/each}}
                    </div>
                    {{/if}}
                {{/each}}
            {{else}}
                <div class="nodata lang"  ><span data-l="1010"></span></div>
            {{/if}}
		</script>
		
		<!--荤素小图标模板-->
		<div class="tag_box" id="tag_box"></div>
		<script type="text/html" id="tag_js">
			<div class="w">
				<a class="close" href="javascript:;">X</a>
				<div class="p fiex">
					{{each list as v i}}
						{{if v=="k1"}}
							<p class="fiex1">
								<img src="../images/k1.png" />
								<span>{{gl.k1}}</span>
							</p>
						{{/if}}
						{{if v=="k2"}}
							<p class="fiex1">
								<img src="../images/k2.png" />
								<span>{{gl.k2}}</span>
							</p>
						{{/if}}
						{{if v=="k3"}}
							<p class="fiex1">
								<img src="../images/k3.png" />
								<span>{{gl.k3}}</span>
							</p>
						{{/if}}
						{{if v=="k4"}}
							<p class="fiex1">
								<img src="../images/k4.png" />
								<span>{{gl.k4}}</span>
							</p>
						{{/if}}
						{{if v=="k5"}}
							<p class="fiex1">
								<img src="../images/k5.png" />
								<span>{{gl.k5}}</span>
							</p>
						{{/if}}
					{{/each}}
					
					
				</div>
			</div>
		</script>			
		<!--end-->
		
		<!--普通规格弹出-->
		<div class="guige" id="putong_guige"></div>
		<script type="text/html" id="guige-js">
			<div class="guige-box"><i class="bg"></i>
				<div class="g-box">
					<a href="javascript:;" class="close1"><svg class="g2" ><use xlink:href="#f_9"></use></svg></a>
					<div class="w">
						<div class="maxscroll">
						<div class="name center  f-32">{{name}} {{if !spec[0]}}<span class="red">({{price}})</span>{{/if}}</div>
						
						{{if spec[0]}}
						<dl class="dl mag-t-10 guige-box1" id="guige-box1">
							<dt class="mag-b-10 c999"><span data-l="1053"></span></dt>
							<dd class="f-26 pad-t-10 pad-b-20">
								{{each spec as v i}}
								<a href="javascript:;" class="{{if i==0}}on{{/if}}" data-id="{{v.spec_id}}" data-price="{{v.goods_price}}">{{v.goods_spec_name}}<div class="red f-24">{{v.goods_price}}</div></a>
								{{/each}}
							</dd>
						</dl>
						<div class="line-ddd "></div>
						{{/if}}
						
						{{if taste[0]}}
						<dl class="dl mag-t-10  guige-box2" id="guige-box2">
							<dt class="mag-b-10 c999"><span data-l="1055"></span></dt>
							<dd class="f-26 pad-t-10 pad-b-20">
								{{each taste as v i}}
								<a href="javascript:;" class="{{if i==0}}on{{/if}}" data-id="{{v.taste_id}}" data-price="{{v.goods_price}}">{{v.goods_taste_name}}<div class="red f-24">{{v.goods_price}}</div></a>
								{{/each}}
							</dd>
						</dl>
						<div class="line-ddd "></div>
						{{/if}}
						
						{{if garnish[0]}}
						<dl class="dl mag-t-10  guige-box3" id="guige-box3">
							<dt class="mag-b-10 c999"><span data-l="1056"></span></dt>
							<dd class="f-26 pad-t-10 pad-b-20 guige-peicai-list">
								{{each garnish as v i}}
								<a href="javascript:;" class="" data-id="{{v.garnish_id}}" data-price="{{v.goods_price}}" data-name="{{v.goods_garnish_name}}" data-count="0" ><em>1</em>{{v.goods_garnish_name}}<div class="red f-24">{{v.goods_price}}</div></a>
								{{/each}}
																
							</dd>
						</dl>
						
						{{/if}}
						
						<div class="bank100"></div>
						
						</div>
						
						<div class="b cf fiex">
							<div class="fiex2 bs1 red f-32 " id="pirce_b" style="min-width: 5em;">
								{{each spec as v i}}{{if i==0}}{{v.goods_price}}{{/if}}{{/each}}
							</div>
							<div class="fiex3 bs2">
								<div class="addright_s cf" id="addright_s" data-count="1" >
                                    <div class="p p1 disable"><i></i><svg class="g1"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#f_4"></use></svg></div>
                                    <span class="g3 f-30">1</span>
                                    <div class="p p2 "><i></i><svg class="g2"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#f_5"></use></svg></div>
                                </div>
							</div>
							<div class="fiex3 bs3 f-right"><a href="javascript:;" class="bon-red f-32" data-l="1013"></a></div>
							
						</div>
					</div>
				</div>
			</div>
		</script>
		<!--end-->
		
	
		<!--分布点餐弹出规格-->
		<div class="guige_fenbu guige" id="guige_fenbu" > 
			<div class="guige-box fiex" v-if="open"><i class="bg"  ></i>
				<div class="g-box fiex1" style="margin-top: -150px;">
					<a href="javascript:;" class="close1" @click="close()" ><svg class="g2"><use xlink:href="#f_9"></use></svg></a>
					<div class="w">
						<div class="maxscroll">
							<div class="name center ellipsis f-32 pad-b-10">
								{{obj.name}}
								<span class="red" :class="{hide:obj.spec.length}">({{obj.price}})</span>
							</div>
							<div class="line-ddd"></div>
							<div class="fenbu_item_box" id="fenbu_item_box">
								
							<div class="fenbu_item" :class="{op1:s_obj.guige.o==0}"  v-if="obj.spec.length" style="display: none;">
								<div class="s1 fiex" v-if="s_obj.guige.i != null" @click="set_edit('spec',$event)">
									<span class="f-32 mag-r-10">{{lg[1053]}}：</span>
									<div class="fiex1">
										<span class="f-32 mag-r-5" style="color: #0066ff;">{{s_obj.guige.i.goods_spec_name}}</span>
										<span class="f-30 red">{{s_obj.guige.i.goods_price}}</span>
									</div>
									<span class="deg"><svg class="g2" style="width: 10px; height: 10px; fill: #999;"><use xlink:href="#f_xiala"></use></svg></span>
								</div>
								<div class="s2" :class="{hide:s_obj.guige.o == 1}">
									<div class="t center c666 mag-t-10">{{lg[1263]}}</div>
									<dl class="dl mag-t-10 " >
										<dd class="f-32 pad-t-10 pad-b-20 center" >
											<a href="javascript:;" v-for="(v,i) in obj.spec" :class="seton(v.spec_id,'spec')" @click="setguige('spec',v,$event)">{{v.goods_spec_name}}<div class="red f-24">{{v.goods_price}}</div></a>
										</dd>
									</dl>
								</div>
							</div>
							<div class="fenbu_item" :class="{op1:s_obj.kouwei.o==0}" v-if="obj.taste.length"  style="display: none;">
								<div class="s1 fiex" v-if="s_obj.kouwei.i != null"  @click="set_edit('taste',$event)">
									<span class="f-32 mag-r-10">{{lg[1012]}}：</span>
									<div class="fiex1">
										<span class="f-32 mag-r-5" style="color: #0066ff;">{{s_obj.kouwei.i.goods_taste_name}}</span>
										<span class="f-30 red"><span class="c666 f-24">+</span>{{s_obj.kouwei.i.goods_price}}</span>
									</div>
									<span class="deg"><svg class="g2" style="width: 10px; height: 10px; fill: #999;"><use xlink:href="#f_xiala"></use></svg></span>
								</div>
								<div class="s2" :class="{hide:s_obj.kouwei.o == 1}">
									<div class="t center c666 mag-t-10">{{lg[1264]}}</div>
									<dl class="dl mag-t-10 " >
										<dd class="f-32 pad-t-10 pad-b-20 center">
											<a href="javascript:;" v-for="(v,i) in obj.taste" :class="seton(v.taste_id,'taste')" @click="setguige('taste',v,$event)">{{v.goods_taste_name}}<div class="red f-24">{{v.goods_price}}</div></a>
										</dd>
									</dl>
								</div>
							</div>
							<div class="fenbu_item" :class="{op1:s_obj.peicai.o==0}" v-if="obj.garnish.length"  style="display: none;">
								<div class="s1 fiex" v-if="s_obj.peicai.over == 1" @click="set_edit('garnish',$event)">
									<span class="f-32 mag-r-10">{{lg[1056]}}：</span>
									<div class="fiex1" v-if="s_obj.peicai.i" >
										<template v-if="s_obj.peicai.l==0">
											<p>{{lg[1265]}}</p>
										</template>
										<template v-else>
											<p v-for="(v,i) in s_obj.peicai.i">
												<span class="f-32 mag-r-5" style="color: #0066ff;">{{v.goods_garnish_name}}</span>
												<span class="f-30 red"><span class=" f-20" style="color: #0066ff;">+</span>{{v.goods_price}}</span>
												<span class="mag-l-5" style="color: #0066ff;"><i class="f-20">x</i><i class="f-40">{{v.num}}</i></span>
											</p>	
										</template>
									</div>
									<span class="deg"><svg class="g2" style="width: 10px; height: 10px; fill: #999;"><use xlink:href="#f_xiala"></use></svg></span>
								</div>
								<div class="s2" :class="{hide:s_obj.peicai.o == 1}">
									<div class="t center c666 mag-t-10">
										<p>{{lg[1266]}}</p>
										<p class="f-20 red">（{{lg[1267]}}）</p>
									</div>
									<dl class="dl mag-t-10 guige-box3" >
										<dd class="f-32 pad-t-10 pad-b-20 center">
											<a href="javascript:;" v-for="(v,i) in obj.garnish" :class="seton(v.garnish_id,'garnish')" @click="setguige('garnish',v,$event)">
										<template v-if="s_obj.peicai.i"><em v-if="s_obj.peicai.i['a'+v.garnish_id]">{{s_obj.peicai.i['a'+v.garnish_id].num}}</em></template>		
										{{v.goods_garnish_name}}<div class="red f-24">{{v.goods_price}}</div></a>
										</dd>
									</dl>
									
									<div class="peicai_bon fiex f-30 pad-l-20 pad-r-20" :class="{hide:s_obj.peicai.o == 1}" >
									<div class="fiex1"><a href="javascript:;"  @click="set_peicai('null',$event)">{{lg[1268]}}</a></div>
									<div class="fiex1">
										<a href="javascript:;" @click="set_peicai('over',$event)" >
											<span class="fiex">
												<svg class="g1" style="width: 1em; height: 1em; fill: #fd3d3d;"><use xlink:href="#f_11"></use></svg>
												<span class="fiex1 pad-l-10">{{lg[1269]}}</span>
											</span>
										</a>
									</div>
									
								</div>
									
								</div>
								
								
								
							</div>
							
							<div class="fenbu_item fenb_bottom" style="display: none;">
								<div class="t center c666 mag-t-10">{{lg[1270]}}</div>
								 <div class="bank40"></div>
								<div class="addright_a cf" >
                                    <div class="p p1 " :class="{disable:s_obj.num==1}"  @click="jiajian(0)"><i></i><svg class="g1"><use xlink:href="#f_4"></use></svg></div>
                                    <span class="g3 f-36 red f-bold">{{s_obj.num}}</span>
                                    <div class="p p2 "  @click="jiajian(1)"><i></i><svg class="g2"><use xlink:href="#f_5"></use></svg></div>
                                </div>
                                <div class="bank80"></div>
								<div class=" fiex">
									<div class="fiex1 f-40">{{lg[1271]}}：<span class="red">{{s_obj.pice}}</span></div>
									<div class="f-right">
										<a href="javascript:;" @click="sub($event)" class="bon-red f-30" style="padding: 0.2rem 0.2rem; min-width: 2rem;">{{lg[1272]}}</a>
									</div>
								</div>
							</div>
							</div>
						</div>
					</div>
				</div>	
			</div>
		</div>
		<!--end-->

		<div class="beizhu" id="beizhu"></div>
	<script type="text/html" id="beizhu-js">
			<div class="guige-box">
				<div class="bg"></div>
				<div class="g-box">
					<a href="javascript:;" class="close1"><svg class="g2"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#f_9"></use></svg></a>
					<div class="w">
						<div class="maxscroll">						
						
						<dl class="dl mag-t-10  guige-box4" id="all-beizhu" >
							
							<dd class="f-24 pad-t-10 pad-b-20" id="guige-beizhu" style="display: block;">
								
				                {{if beizhu}}
				                	{{each beizhu as v i}}
				                		<span class="gp st-a">
				                			{{each v.list as vv ii}}
						                		<a href="javascript:;" class="a" >{{vv.name}}</a>
						                	{{/each}}
										</span>
				                	{{/each}}
				                {{/if}}
				                
				                <br>
				                <div class="f-right fiex input">
				                	<div class="fiex3">
				                		<input type="text" id="beizhuinp" maxlength="100" placeholder="" data-p="1068" />
				                	</div>
				                	<div class="fiex2">
				                		<span class="bon-black bon" style="padding: 0.1rem 0.2rem;" data-l="1067"></span>
				                	</div>				                	
				                </div>
							</dd>
						</dl>
						
						<div class="bank100"></div>
							<div class="b cf fiex">
							
							<div class="fiex1 f-right">
								<div class="pad-r-15"><a href="javascript:;" class="bon-red f-32"  data-l="1016"></a></div>
							</div>
							
						</div>
						</div>
					</div>
					</div>
				
					
				
			</div>
		</script>
		<style>
			.other-list table .td5 .w:before{ border-color: #fafafa;}
			table .td4{border-right: 1px solid #aaa;}
			.other-list { opacity: 0.7;}
		</style>
        <div class="select_article">
            <div class="box">
                <a href="javascript:;" class="close"><svg class="g2" ><use xlink:href="#f_9"></use></svg></a>
                <div class="w" style="padding: 0.2rem;" id="article-w"></div>                
            </div>
            <i class="bg_mask"></i>
        </div>

        <div class="mask"></div>      
    </section>
    <script type="text/html" id="article-js">
                	<div class="cf mag-b-10">
                		 {{if goods_thumb!=""}}
                		 <div class="img  mag-b-20" style=" width:100%; background-image: url({{oss}}/Public/Upload/image/{{goods_thumb}}?x-oss-process=image/resize,m_fill,h_600,w_600);">
                		 	<img src="{{oss}}/Public/Upload/image/{{goods_thumb}}?x-oss-process=image/resize,m_fill,h_600,w_600" style="height: 6.2rem;" onerror="lod(this)" />
                		 </div>
                		 {{/if}}
                		 <div class="oh">
                		 	<div class="t1">{{goods_name}}</div>
                    		<div class="t2" style="padding: 0.1rem  0 0;">{{goods_price}}</div>
                		 </div>
                	</div>
                   
                    <div class="line-eee"></div>
                    <div class="tmaxheigt" >
                    	<div class="t3">
                        <dl class="cf">
                            <dt class="fl lang"  data-l="1011"></dt>
                            <dd class="oh">{{goods_material}}</dd>
                        </dl>
                        </div>
                    <div class="t3">
                        <dl class="cf">
                            <dt class="fl lang"  data-l="1012"></dt>
                            <dd class="oh">{{goods_taste}}</dd>
                        </dl>
                    </div>
                    </div>
                   
                </script>
    
    
    
    <!--套餐模板-->
			<div class="pack_mask_box" id="pack_box" v-if="open">
				<div class="box1" >
							<div class="bg-fff " style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; width: 100%; height: 100%; overflow: auto;">
								<div class="titles fiex" @click="close()" style="background: #fff; z-index: 100;">
									<div class="p black pad-l-20" style="background:#fff;" ><svg style="fill: #000000;" class="g2"><use xlink:href="#f_black"></use></svg></div>
									<div class="fiex1 f-30 ellipsis c000"><span class="fiex1">({{lange[1365]}}) {{obj_select.name}}</span></div>
								</div>
								<div class="taocan-head pad-t-10" style="position: fixed; top: 0.8rem; left: 0; right: 0; background: #FFF; z-index: 100;">
										<div class="w ">
											<span v-for="(v,i) in obj.package_cate_list" class="a f-28" :class="{'on':v.select==1}" @click="tab(i)">{{v.cate_name}}</span>
										</div>
										<div class="line-ddd mag-t-10 mag-b-10"></div>
								</div>
								<div class="pad-10 pad-t-15">
									<div class="bank80"></div>		
									<div class="bank100"></div>		
									
									
									<div class="taocan-body" >
										<div class="b oh" v-for="(v,i) in obj.package_cate_list" v-show="v.select==1">
											<div class="list_name f-left"><span class="f-30 mag-r-10">{{v.cate_name}}</span>  <span class="c999">{{lange[1366]}} <i class="red f-24 f-bold">{{v.count}}</i></span></div>
											<div class="bank20"></div>
											<ul class="list cf ">
												<li  v-for="(vv,ii) in v.goods_list" :class="{'on':vv.select==1,'cur':(obj_child?ii==obj_child.b:0)}" v-if="vv.status==1">
													<div class="duigou"><svg class="g2"><use xlink:href="#f_11"></use></svg></div>
													<div class="w f-left"   @click="select_list(i,ii)">
														<div class="n oh ellipsis-2 f-32">{{cainame[vv.goods_id].goods_name}}</div>
														<div class="b fiex f-24">
															<div class="fiex1 red" >
																<template v-if="vv.goods_price!='0.00'">+{{vv.goods_price}}</template>
																<template v-else="">&nbsp;</template>
															</div>
															<div class="c999 " v-if="vv.spec_list.length || vv.taste_list.length || vv.garnish_list.length">{{lange[1367]}}</div>
														</div>
													</div>
												</li>
												
												<li  v-for="(vv,ii) in v.goods_list"  v-if="vv.status==0">
													<div class="w f-left null"    >
														<div class="n oh ellipsis-2 f-32">{{cainame[vv.goods_id].goods_name}}</div>
														<div class="b fiex f-24">
															<div class="fiex1" ></div>
															<div class="p"> {{lange[1368]}} </div>
														</div>
													</div>
												</li>
											</ul>
										</div>
									</div>
									<div class="bank80"></div>		
									<div class="bank100"></div>	
									<div class="bank100"></div>	
									<div class="bank100"></div>	
								</div>
								<div class="bottoms" style="background: rgba(255,255,255,0.9); box-shadow: 0 0 5px rgba(0,0,0,0.2); z-index: 100;">
									<div class=" pad-10 f-left" style="max-height: 150px; overflow: auto;">
										<div class="cf mag-t-10 f-28" v-for="(v,i) in obj_select.list">
											<span class="fl c333">{{v.cate_name}}：</span>
											<div class="oh">
												<div v-if="v.goods.length">
												<p   v-for="(vv,ii) in v.goods">
													<span class="c000">{{cainame[vv.goods_id].goods_name}} </span>
													<span class="red" v-if="vv.goods_price!='0.00'">+{{vv.goods_price}}</span>
													<template v-if="vv.spec_list[0]">
														<span class="c999 mag-l-5">[{{guige[vv.spec_list[0].spec_id].goods_spec_name}} ]</span>
														<span class="red" v-if="vv.spec_list[0].goods_price!='0.00'">+{{vv.spec_list[0].goods_price}}</span>
													</template>
													<template v-if="vv.taste_list[0]">
														<span class="c999 mag-l-5">[{{kouwei[vv.taste_list[0].taste_id].goods_taste_name}} ]</span>
														<span class="red" v-if="vv.taste_list[0].goods_price!='0.00'">+{{vv.taste_list[0].goods_price}}</span>
													</template>
													<span class="pad-l-5 red "  style="color: #3b2cff;"><i class="f-12">x</i> {{vv.count}}</span>
													<template v-if="vv.garnish_list[0]">
														<div class="f-24 c666 pad-l-20">
														<span class="mag-r-10" v-for="(vvv,iii) in vv.garnish_list">
															+{{peicai[vvv.garnish_id].goods_garnish_name}} 
															<span class="red" v-if="vvv.goods_price!='0.00'">+{{vvv.goods_price}}</span>
														    <em v-if="vvv.count>1" class="red" style="color: #3b2cff;"><i cite="f-10">x</i> {{vvv.count}}</em>
														</span>
														</div>
													</template>
												</p>
												</div>
												<div v-else="" class="red">{{lange[1369]}}</div>
											</div>
										</div>
									</div>

									<div class="b fiex pad-20 mag-t-10" style="border-top: 1px solid #ddd; background: #fff;">
										<div class="">
											<p>
												<template v-if="obj_select.total_price != obj_select.goods_price">
													<s class="c999 pad-l-10" >{{obj_select.goods_price}}</s>
													<i class="f-40 red pad-l-10">{{obj_select.total_price}}</i>
												</template>
												<template v-else>
													<i class="f-40 red pad-l-10">{{obj_select.goods_price}}</i>
												</template>
											</p>
										</div>
										<div class="f-right fiex1">
											<a class="bon-red f-32" style="padding: 0.1rem; min-width: 1.6rem;" @click="sub()">{{lange[1370]}}</a>
										</div>
									</div>
								</div>
							</div>
						
				</div>
				
				<template v-if="obj_child">
								<div class="bg-fff right-child pad-10 fiex" style=""   v-if="obj.package_cate_list[obj_child.a].count > 1 || obj_child.spec_list.length || obj_child.taste_list.length || obj_child.garnish_list.length" >
									<div class="fiex1">
										
									<div class="bg-fff" style="width: 6.4rem; margin: 0 auto; border-radius: 5px; overflow: hidden;">
										
										<div class="child_name f-36 pad-20">{{cainame[obj_child.goods_id].goods_name}}</div>
										<div class="line-ddd mag-t-10 mag-b-10"></div>
										<div class="w" style=" max-height: 50vh; min-height: 100px; overflow: auto;">
										<dl class="dl cf fiex pad-20 f-28" v-if="obj.package_cate_list[obj_child.a].count > 1" >
												<dt class="fiex1 pad-r-10" ><span >{{lange[1049]}}</span></dt>
												<div class="fiex1">
													<div class="addright_s cf " style="width: 120px;" data-count="1">
						                                    <div class="p p1" @click="select_list_addsub(obj_child.a,obj_child.b,1)"><i></i><svg class="g1"><use  xlink:href="#f_jia"></use></svg></div>
						                                    <span class="g3 f-40" >{{obj_child.count}}</span>
						                                    <div class="p p2 " @click="select_list_addsub(obj_child.a,obj_child.b,2)"><i></i><svg class="g2"><use  xlink:href="#f_jian"></use></svg></div>
						                                </div>
												</div>
												<div class="fiex1  f-right pad-r-10" @click="select_list_addsub(obj_child.a,obj_child.b,0)">
					                    			<svg class="g1" style="width: 22px; height: 22px; vertical-align: top;"><use xlink:href="#f_qingkong"></use></svg>
					                    		</div>
												
										</dl>
										
										<dl class="pad-20 f-28"style="padding-top: 0;" v-if="obj_child.spec_list.length">
											<dt class="mag-b-10">{{lange[1053]}}</dt>
											<dd class="cf">
												<a class="a"  v-for="(v,i) in obj_child.spec_list" :class="{'on':v.count==1}" @click="guige_select('spec',i)" >
													<p>{{guige[v.spec_id].goods_spec_name}}</p>
													<span>{{v.goods_price}}</span>
												</a>
											</dd>
										</dl>
										<dl class="pad-20 f-28" style="padding-top: 0;" v-if="obj_child.taste_list.length">
											<dt class="mag-b-10">{{lange[1055]}}</dt>
											<dd class="cf">
												<a class="a" v-for="(v,i) in obj_child.taste_list" :class="{'on':v.count==1}" @click="guige_select('taste',i)" >
													<p>{{kouwei[v.taste_id].goods_taste_name}}</p>
													<span>{{v.goods_price}}</span>
												</a>
											</dd>
										</dl>
										<dl class="pad-20 f-28"style="padding-top: 0;" v-if="obj_child.garnish_list.length">
											<dt class="mag-b-10">{{lange[1056]}}</dt>
											<dd class="cf">
												<a class="a" v-for="(v,i) in obj_child.garnish_list"  :class="{'on':v.count>=1}" @click="guige_select('garnish',i)" >
													<i v-if="v.count>=1">{{v.count}}</i>
													<p>{{peicai[v.garnish_id].goods_garnish_name}}</p>
													<span>{{v.goods_price}}</span>
												</a>
											</dd>
										</dl>
										</div>
										<div class="line-ddd"></div>
										<div class="bottom">
											<div class="fiex f-36">
												<div class="fiex1 pad-10 pad-t-20 pad-b-20 b c000" @click="guige_sub()">{{lange[1016]}}</div>
											</div>
										</div>
										
									</div>
									
									</div>
								</div>
							</template>
			
			</div>
			
    
    
    <script>
        
        
        		//套餐选择
			var pack_box = new Vue({
			  el: '#pack_box',
			  data: {
			    lange: lange,//全局语言
			    cainame:caidan_json,//菜名对象
			    guige:guige1_json,//规格名对象
			    kouwei:kouwei1_json,//口味名对象
			    peicai:peicai_json,//配菜名对象
			    open:0,//是否开启
			    obj_index:0,//套餐索引值
			    obj:{},//套餐对象
			    obj_child:null,//选择菜品的属性
			    obj_select:{
			    	name:"",
			    	id:0,
			    	goods_price:0,
			    	total_price:0,
			    	list:[]
			    },//最终选择的对象
			    cart_id:null//是否为修改
			  },
			  mounted:function(){
			  	
			  },
			  methods:{
			  	start:function(e){//初始化
			  		var $th=this;
			  		$th.obj=$.extend(true, {},e);
			  		
			  		$th.cart_id=null;
					$th.open=1;
					$th.obj_select.name=$th.obj.goods_name;
					$th.obj_select.id=$th.obj.id;
					$th.obj_select.goods_price=$th.obj.goods_price;
					$th.obj_select.total_price=$th.obj.goods_price;
					$th.obj_select.sn=$th.obj.sn;
					$th.obj_select.list=[];
					$th.obj_child=null
					$.each($th.obj.package_cate_list,function(i,v){
						if(i==0) v["select"]=1;
						$th.obj_select.list.push({cate_name:v.cate_name,count:v.count,id:v.id,goods:[]})//插入选择
						$.each(v.goods_list, function(ii,vv) {
							vv['status']=guqing_obj.list[vv.goods_id]?0:1;
							
							if(vv.spec_list[0]) vv.spec_list[0].count=1;//默认选中第一个规格
			  		    	if(vv.taste_list[0]) vv.taste_list[0].count=1;//默认选中第一个口味
							
						});
					})
					console.log($th.obj)
			  	},
			  	rest:function(a){//修改初始化
			  		var $th=this,
			  			newtaocan=null;
			  
			  		$th.cart_id={
			  			cart_id:$(".opens","#my-list").attr("data-cart_id"),
			  			index:$(".opens","#my-list").index()
			  		}//购物车id;
			  		$.each(set_select_json.list[2].goods_list, function(i,v) {
			  			if(v.id==a.id){
			  				newtaocan=v;
			  			}
			  		});
			  		
			  		$th.obj=$.extend(true, {},newtaocan);
			  		$th.open=1;
			  		
			  		$th.obj_select.name=$th.obj.goods_name;
					$th.obj_select.id=$th.obj.id;
					$th.obj_select.goods_price=$th.obj.goods_price;
					$th.obj_select.total_price=$th.obj.goods_price;
					$th.obj_select.sn=$th.obj.sn;
					$th.obj_select.list=[];
					$th.obj_child=null
					$.each($th.obj.package_cate_list,function(i,v){
						if(i==0) v["select"]=1;
						$th.obj_select.list.push({cate_name:v.cate_name,count:v.count,id:v.id,goods:[]})//插入选择
						$.each(v.goods_list, function(ii,vv) {
							vv['status']=guqing_obj.list[vv.goods_id]?0:1;
							$.each(a.json1.package_goods_list,function(iii,vvv){
								if(vvv.cate_id==v.id && vvv.goods_id==vv.goods_id){
									vv["select"]=1;
									vv["count"]=vvv.count;
									if(vvv.taste_id){
										$.each(vv.taste_list, function(iiii,vvvv) {
											if(vvvv.taste_id==vvv.taste_id){
												vvvv["count"]=1;
											}
										});
									}
									if(vvv.spec_id){
										$.each(vv.spec_list, function(iiii,vvvv) {
											if(vvvv.spec_id==vvv.spec_id){
												vvvv["count"]=1;
											}
										});
									}
									if(vvv.garnish_ids.length){
										$.each(vv.garnish_list, function(iiii,vvvv) {
											$.each(vvv.garnish_ids, function(iiiii,vvvvv) {
												if(vvvv.garnish_id==vvvvv.garnish_id){
													vvvv["count"]=vvvvv.count;
												}
											});
										});
									}
								}
							});
						});
					})
					console.log()
					console.log(a)
					var ll=$th.obj.package_cate_list
			  		    $th.obj.package_cate_listd=""
			  		    $th.obj.package_cate_list=ll;
					 $th.gengxin()//更新选择对象
			  	},
			  	close:function(){//关闭
			  		this.open=0;
			  	},		
			  	tab:function(i){
			  		$.each(this.obj.package_cate_list, function(s,v) {
			  			if(s==i){
			  				v["select"]=1;
			  			}else{
			  				v["select"]=0;
			  			}
			  		});
			  		this.obj_child=null
			  		var c=this.obj.package_cate_list
			  		    this.obj.package_cate_list=""
			  		    this.obj.package_cate_list=c;
			  	},
			  	select_list:function(a,b,c){//菜品选择
			  		var $th=this,
			  		    $a=$th.obj.package_cate_list[a],
			  		    $b=$a.goods_list[b];
			  		    
			  		    var num=0;
			  				$.each($th.obj_select.list[a].goods, function(i,v) {
			  					num+=Number(v.count)
			  				});
			  				
			  			if($a.count!=1 && $a.count-num<=0 && $b["select"]!=1){
			  				$.toast("<p class='f-32 pad-10 pad-b-20'>"+ lange[1371] +"<span class='red pad-l-10 f-40 f-bold'>"+$a.count+"</span></p>","cancel");
			  				return false;
			  			}
			  		    
			  		    $b['goods_cate_id']=caidan_json[$b.goods_id].goods_cate_id
			  		    $th.obj_child=$b;
			  		    $th.obj_child["count"]=$b.count?$b.count:1;
			  		    $th.obj_child["a"]=a;
			  		    $th.obj_child["b"]=b;
			  			
			  		    if($a.count==1){//如果是一个直接替换
			  		    	$.each($a.goods_list, function(i,v) {
			  		    		v["select"]=0;
			  		    	});
			  		    	$b["select"]=1;
			  		    }else{//
			  		    	$b["select"]=1;
			  		    }
			  		    $th.gengxin()//更新选择对象
			  	},
			  	select_list_addsub:function(a,b,type){
			  		var $th=this,
			  			$a=this.obj.package_cate_list[a],
			  		    $b=$a.goods_list[b];
			  		
			  		switch (type){
			  			case 0://删除
			  				$b["select"]=0;
			  				$th.obj_child=null
			  				break;
			  			case 1://减少
			  				$th.obj_child.count--;
			  				if($th.obj_child.count<1){
			  					$b["select"]=0;
			  					$th.obj_child=null
			  				};
			  				break;
			  			case 2://增加
			  				var num=0;
			  				$.each($th.obj_select.list[a].goods, function(i,v) {
			  					num+=Number(v.count)
			  				});
			  			    if(accSub($a.count,num)!=0){
			  			    	$th.obj_child.count++;
			  					if($th.obj_child.count> $a.count) $th.obj_child.count=$a.count;
			  			    }else{
			  			    	
			  			    	$.toast("<p class='f-32 pad-10 pad-b-20'>"+ lange[1371] +"<span class='red pad-l-10 f-40 f-bold'>"+$a.count+"</span></p>","cancel");
			  			    }
			  				
			  				break;
			  		}
			  		var b=$th.obj_child
			  		    $th.obj_child=""
			  		    $th.obj_child=b;
			  		$th.gengxin()//更新选择对象
			  	},
			  	guige_sub:function(){
			  		this.obj_child=null;
			  	},
			  	guige_select:function(a,b){//规格口味配菜选择
			  		var $th=this,
			  			b=b;
			  		console.log(a,b)
			  		switch (a){
			  			case 'spec'://规格
			  				$.each($th.obj_child.spec_list, function(i,v) {v["count"]=0;});
			  		    	$th.obj_child.spec_list[b]["count"]=1;			  		    	
			  				break;
			  			case 'taste'://口味
			  				$.each($th.obj_child.taste_list, function(i,v) {v["count"]=0;});
			  		    	$th.obj_child.taste_list[b]["count"]=1;
			  				break;
			  			case 'garnish'://配菜
			  			
			  				var garnish_num=$th.obj_child.garnish_list[b]["count"]
			  				if(garnish_num>=1){//如果大于等于1 弹出层
			  					
						var html1 = '<div class="peiliaoadd  fiex cf">';
			                html1+='<div class="p p1 fiex1"><i></i><svg class="g1" ><use xlink:href="#f_jia"></use></svg></div>';
			                html1+='<span class="  fiex1"><span class="g3 f-32">'+ garnish_num +'</span></span>';
			                html1+='<div class="p p2 fiex1"><i></i><svg class="g2" ><use xlink:href="#f_jian"></use></svg></div>';
			                html1+='</div>';
							var b_index=b;
			                $.modal({
			                    title: peicai_json[$th.obj_child.garnish_list[b].garnish_id].goods_garnish_name,
			                    text: "<p class='dp-1 red'>" + $th.obj_child.garnish_list[b].goods_price + "</p><div class='dp-2 mag-t-20 pad-b-20 pad-r-40 pad-l-40'>" + html1 + "</div>",
			                    buttons: [
			                      { text: "<span class='aaa'>"+ lange["1062"] +"</span>", onClick: function () {   
			                      	console.log(b_index)
			                      		//console.log($th.obj_child.garnish_list[b])
										$th.obj_child.garnish_list[b_index]["count"]=0;
										var c=$th.obj_child
							  		    $th.obj_child=""
							  		    $th.obj_child=c;
							  		    $th.gengxin()//更新选择对象
			                        }},
			                      {
			                          text: lange["1016"], onClick: function () {
			                          	console.log(b_index)
										$th.obj_child.garnish_list[b_index]["count"]=garnish_num;
										var c=$th.obj_child
							  		    $th.obj_child=""
							  		    $th.obj_child=c;
							  		    $th.gengxin()//更新选择对象
			                          }
			                      }
			                    ]
			                });
			
							//数量减
							var $pei=$(".peiliaoadd")
								//console.log($pei)
								$(".peiliaoadd .p1").click(function(){
									garnish_num--;
									if(garnish_num<=1) {
										garnish_num=1;
										$pei.addClass("null1")
									};
									$pei.find(".g3").text(garnish_num)
								})
								//数量加
								$(".peiliaoadd .p2").click(function(){
									garnish_num++;
									$pei.removeClass("null1")
									$pei.find(".g3").text(garnish_num)
								})
			  				}else{//否则加1
			  					$th.obj_child.garnish_list[b]["count"]=1;
			  				}
			  		    	
			  				break;
			  			default:
			  				break;
			  		}
			  		var b=$th.obj_child
			  		    $th.obj_child=""
			  		    $th.obj_child=b;
			  		    $th.gengxin()//更新选择对象
			  	},
			  	gengxin:function(){
			  		var $th=this;
			  		//更新选择数据
			  		var price22=$th.obj_select.goods_price;
			  		$.each($th.obj.package_cate_list,function(i,v){
			  			//console.log();
			  			if(v.count>1){
			  				$th.obj_select.list[i].goods=[];
			  			}
			  			
			  			$.each(v.goods_list, function(ii,vv) {
			  				//$th.obj_select.list[i].goods=[];
			  				if(vv.select==1){
			  					var nboj={
			  						id:vv.id,
			  						goods_id:vv.goods_id,
			  						goods_price:vv.goods_price,
			  						count:vv.count,
			  						goods_cate_id:caidan_json[vv.goods_id].goods_cate_id,
			  						spec_list:[],
			  						taste_list:[],
			  						garnish_list:[]
			  					}
			  					var price_child=vv.goods_price;
			  					
			  					//price=accMul(accAdd(price,vv.goods_price),vv.count)
			  					
			  					//规格
			  					$.each(vv.spec_list, function(iii,vvv) {
			  						if(vvv.count>=1){
			  							nboj.spec_list.push(vvv);
			  							price_child=accAdd(price_child,vvv.goods_price)
			  						}
			  					});
			  					
			  					//口味
			  					$.each(vv.taste_list, function(iii,vvv) {
			  						if(vvv.count>=1){
			  							nboj.taste_list.push(vvv);
			  							price_child=accAdd(price_child,vvv.goods_price)
			  						}
			  					});
			  					
			  					//配菜
			  					$.each(vv.garnish_list, function(iii,vvv) {
			  						if(vvv.count>=1){
			  							nboj.garnish_list.push(vvv);
			  							price_child=accAdd(price_child,accMul(vvv.goods_price,vvv.count))
			  						}
			  					});
			  					//price=accMul(accAdd(price,price_childe),vv.count);
			  					
			  					
			  					console.log(price_child)
			  					if(v.count>1){//如果选择大于1 插入数组
			  						$th.obj_select.list[i].goods.push(nboj)
			  					}else{//否则
			  						$th.obj_select.list[i].goods=[nboj];
			  					}
			  					console.log(price22)
			  					console.log(price_child,vv.count)
			  					price22=accAdd(price22,accMul(price_child,vv.count))
			  					console.log(price22)
			  				}
			  			});
			  		});
			  		
			  		$th.obj_select.total_price=price22;
			  	},
			  	sub:function(){
			  		var $th=this;
			  		
			  		var jsonobj={
			  			goods_name:$th.obj_select.name,
			  			goods_price:$th.obj_select.goods_price,
			  			total_price:$th.obj_select.total_price,
			  			id:$th.obj_select.id,
			  			sn:$th.obj_select.sn,
			  			goods_cate_id:0,
			  			taocan:1,
			  			is_package_goods:1,
			  			package_cate_list:[],
			  			package_goods_list:[]
			  		}
			  		
			  		var stops=true;
			  		$.each($th.obj_select.list, function(i,v) {
			  			jsonobj.package_cate_list.push({id:v.id,name:v.cate_name})//分组
			  			var numbers1=0;
			  			$.each(v.goods, function(ii,vv) {
			  				var arrs1={
				  				cate_id:v.id,
				  				sn:0,
				  				member_id:'test_c',
				  				goods_cate_id:vv.goods_cate_id,
				  				count:vv.count,
				  				goods_id:vv.goods_id,
				  				goods_name:0,
				  				status:1,
				  				goods_price:vv.goods_price,
				  				remarks:0,
				  				spec_id:vv.spec_list[0]?vv.spec_list[0].spec_id:0,
				  				goods_spec_name:0,
				  				taste_id:vv.taste_list[0]?vv.taste_list[0].taste_id:0,
				  				goods_spec_price:vv.spec_list[0]?vv.spec_list[0].goods_price:0,
				  				goods_taste_price:vv.taste_list[0]?vv.taste_list[0].goods_price:0,
				  				goods_taste_name:0,
				  				garnish_ids:[]
				  			}
				  			numbers1=accAdd(numbers1,vv.count)
				  			$.each(vv.garnish_list, function(iii,vvv) {
				  				arrs1.garnish_ids.push(vvv);
				  			});
				  			jsonobj.package_goods_list.push(arrs1);//分组菜品
				  			
			  			});
			  			
			  			if(numbers1 != v.count){//如果没有选择菜品
			  				if(!$th.obj.package_cate_list[i].select){
			  					$th.tab(i)
			  				}
			  				$.toast("<p class='f-32 pad-10 pad-b-20'>"+lange[1338]+"：<span class='red pad-l-5'>"+v.cate_name+"</span> , "+lange[1049]+"：<span class='red pad-l-5'>"+v.count+"</span></p>","cancel");
			  				stops=false;
			  				if(!stops) return false;
			  			}
			  			
			  		});
			  		
			  		if(!stops) return false;
			  		console.log(jsonobj)
			  		
			  		//return false;
			  		var ndata=new Date().getTime().toString();   		
					var cart="1"+ndata.substring(5,ndata.length-1) + Math.floor(Math.random()*1000000)
					var data={"cart_id": cart ,"member_id": getCookie("yingsoft_home_member_id"), "count":1,"goods_cate_id": 0, "goods_id": jsonobj.id, "taste_id": 0,"spec_id": 0,"garnish_ids":0,"status":1,"goods_price":jsonobj.goods_price ,total_price: jsonobj.total_price,goods_name: jsonobj.goods_name,"remarks": "","is_pack":0,"is_wait":0,"is_give":0,"is_old":0,"cookbook":localStorage.getItem("cookbook"),is_package_goods:1,package_cate_list:jsonobj.package_cate_list,package_goods_list:jsonobj.package_goods_list};
					
					addgwc($(event.currentTarget));
					
					marry_fun(data);
			  		
			  		
//			  		//is_package_goods
//			  		if($th.cart_id){//判断是否有购物车ID 有就是修改 
//			  			console.log($th.cart_id.cart_id,$th.cart_id.index)
//			  			addspec({"id": jsonobj.id,"json1":jsonobj},$th.cart_id.cart_id,$th.cart_id.index);
//			  		}else{
//			  			addspec({"id": jsonobj.id,"json1":jsonobj});
//			  		}
//			  		
			  		$th.open=0;
			  		
			  	}
			  }
			})

			//套餐end
			
        
  
        //绑定荤素小图标 显示事件
        var tubiao={
        	zh:{
        		k1:"酸",
        		k2:"甜",
        		k3:"辣",
        		k4:"素",
        		k5:"肉"
        	},
        	en:{
        		k1:"Sour",
        		k2:"Sweet",
        		k3:"Spicy",
        		k4:"Veg",
        		k5:"Meat"
        	},
        	ms:{
        		k1:"Masam",
        		k2:"Manis",
        		k3:"Pedas",
        		k4:"Veg",
        		k5:"Daging"
        	}
        }

        //$(document).off("click");
        $(document).on("click","#menu-right .tag",function(e){
        	e.stopPropagation();
			e.preventDefault();
			var $th=$(this)
			var list=[];
			$th.find("i").each(function(){
				var c=$(this).attr("class");
				list.push(c);
			})
        	$("#tag_box").show().html(template("tag_js", {"gl":tubiao[getCookie("language")],"list":list}))
        })
        $("#tag_box").click(function(){
        	$(this).hide();
        });
        //end
        
        
        //分布点餐调用vue
        
        
        //设置vue
		fenbu_vue = new Vue({
		  el: '#guige_fenbu',
		  data: {
		    lg: lange,//全局语言
		    open:false,
		  	obj:{},
		  	s_obj:{guige:{o:0,i:null},kouwei:{o:0,i:null},peicai:{o:0,i:null,over:0,l:0},num:1,pice:0}
		  },
		  methods:{
		  	start:function(){
		  		var $th=this;
		  		//点击弹出分布点餐
		  		this.open=true;
		  		this.s_obj={guige:{o:0,i:null},kouwei:{o:0,i:null},peicai:{o:0,i:null,over:0,l:0},num:1,pice:0}
		  		setTimeout(function(){
		  			$("#guige_fenbu").show()
		  			$("#guige_fenbu .fenbu_item:eq(0)").show();
		  			$th.martop();
		  			
		  			setTimeout(function(){
		  				$("#guige_fenbu .fenbu_item:eq(0)").show();
		  			},100)
		  		},0)
		  	},
		  	seton:function(a,b){//设置显示隐藏
		  		switch (b){
		  			case "spec"://规格选择
		  				if(this.s_obj.guige.i){
			  				if(a==this.s_obj.guige.i.spec_id){
			  					return "on";
			  				}
			  			}
		  				break;
		  			case "taste"://口味选择
		  				if(this.s_obj.kouwei.i){
			  				if(a==this.s_obj.kouwei.i.taste_id){
			  					return "on";
			  				}
			  			}
		  				break;
		  			case "garnish"://配菜选择
		  				break;
		  			default:
		  				break;
		  		}
		  	},
		  	jiajian:function(a){//数量加减
		  		var $th=this;
		  		//a=1 + =0 -
		  		if (a) {
		  			this.s_obj.num++;
		  		} else{
		  			this.s_obj.num--;
		  			if(this.s_obj.num<1) this.s_obj.num=1;
		  		}
		  		$th.jisuanpice();//计算价格
		  	},
		  	jisuanpice:function(){//计算价格
		  		var p=this.obj.price,//原始菜价
		  			$th=this;
		  		console.log($th.s_obj)
		  		//规格价钱
		  		if($th.s_obj.guige.i){		  			
		  			p=$th.s_obj.guige.i.goods_price
		  		}
		  		//口味价钱
		  		if($th.s_obj.kouwei.i){		  			
		  			p=accAdd(p,$th.s_obj.kouwei.i.goods_price)
		  		}
		  		//配菜价钱
		  		if($th.s_obj.peicai.i){		
		  			$.each($th.s_obj.peicai.i, function(i,v) {
		  				var spic=accMul(v.goods_price,v.num)//配菜数量
		  				p=accAdd(p,spic)
		  			});
		  		}
		  		
		  		p=accMul(p,$th.s_obj.num)//乘以数量
		  		
		  		$th.s_obj.pice=toFixed2(p,2);
		  		this.martop();
		  	},
		  	setguige:function(a,b,c){
		  		var $th=this,
		  			$curr=$(c.currentTarget);
		  			
		  		switch (a){
		  			case "spec"://规格选择
		  				this.s_obj.guige.i=b;
		  				this.s_obj.guige.o=1;
		  				$curr.parents(".fenbu_item").next().show();//显示下一个
		  				$th.jisuanpice();//计算价格
		  				break;
		  			case "taste"://口味选择
		  				this.s_obj.kouwei.i=b;
		  				this.s_obj.kouwei.o=1;
		  				$curr.parents(".fenbu_item").next().show();//显示下一个
		  				$th.jisuanpice();//计算价格
		  				break;
		  			case "garnish"://配菜选择
		  				if(this.s_obj.peicai.i==null){
		  					this.s_obj.peicai.i={};
		  				}
		  				if($curr.hasClass("on")){
		  					//点击增加数量
		  					this.fenbu_addnum(this.s_obj.peicai.i["a"+b.garnish_id],function(e){
		  						if(e==0){
		  							delete $th.s_obj.peicai.i["a"+b.garnish_id];
		  							$curr.removeClass("on")
		  							var s=$th.s_obj.peicai.i
		  							if(JSON.stringify(s)=="{}") $th.s_obj.peicai.l=0;
		  							
			  						$th.s_obj.peicai.i={}
			  						$th.s_obj.peicai.i=s
		  						}else{
		  							$th.s_obj.peicai.i["a"+b.garnish_id].num=e;
		  							var s=$th.s_obj.peicai.i
			  						$th.s_obj.peicai.i={}
			  						$th.s_obj.peicai.i=s;
			  						$th.s_obj.peicai.l=1;
		  						}
		  						$th.jisuanpice();//计算价格
		  					})
		  				}else{
		  					//选择一个
		  					var lens=$curr.parents(".fenbu_item").find(".on").length;//配菜种类长度
		  					var garnish_max_count=caidan_json[$th.obj.info.id].garnish_max_count
		  					console.log(lens,garnish_max_count,caidan_json[$th.obj.info.id])
		  					//最大数量限制
							if(lens>= garnish_max_count&& garnish_max_count!=0){	
								$.toast(lange[1261] +"  [ "+garnish_max_count+" ]","text")
								return false;
							}
							//最大限制end
		  					
		  					$curr.addClass("on");
			  				b['num']=1;
			  				b['arr']=[0];
			  				this.s_obj.peicai.i["a"+b.garnish_id]=b;
			  				var s=this.s_obj.peicai.i
			  				this.s_obj.peicai.l=1;
			  				this.s_obj.peicai.i={}
			  				this.s_obj.peicai.i=s
			  				$th.jisuanpice();//计算价格
		  				}
		  				//this.s_obj.peicai.o=1;
		  				break;
		  			default:
		  				break;
		  		}
		  		//console.log(this.s_obj)
		  		//
		  	},
		  	set_peicai:function(a,b){
		  		var $th=this;
		  		switch (a){
		  			case "over":
		  				if($th.s_obj.peicai.i==null){
		  					$th.s_obj.peicai.i={};
		  					$th.s_obj.peicai.l=0;
		  				}
		  				break;
		  			case "null":
		  				this.s_obj.peicai.i={}
		  				this.s_obj.peicai.l=0;
		  				$(b.currentTarget).parents(".fenbu_item").find(".on").removeClass("on")
		  				break;
		  		}
		  		this.s_obj.peicai.o=1;
		  		this.s_obj.peicai.over=1;
		  		$(b.currentTarget).parents(".fenbu_item").next().show();//显示下一个
		  		
		  		$th.jisuanpice();//计算价格
		  	},
		  	set_edit:function(a,b){
		  		//修改以选择
		  		var $th=this,
		  			$curr=$(b.currentTarget),
		  			$par=$curr.parents(".fenbu_item")
		  		switch (a){
		  			case "spec"://规格选择
		  				if($th.s_obj.guige.o){
		  					$th.s_obj.guige.o=0;
		  				}else{
		  					$th.s_obj.guige.o=1;
		  				}
		  				break;
		  			case "taste"://口味选择
		  				
		  				if($th.s_obj.kouwei.o){
		  					$th.s_obj.kouwei.o=0;
		  				}else{
		  					$th.s_obj.kouwei.o=1;
		  				}
		  				break;
		  			case "garnish"://配菜选择
		  				if($th.s_obj.peicai.o){
		  					$th.s_obj.peicai.o=0;
		  				}else{
		  					$th.s_obj.peicai.o=1;
		  				}
		  			break;
		  		}
		  		//
		  		this.martop();
		  	},
			sub:function(e){
				var $th=this,
					$st=$th.obj,
					$obj=$th.s_obj,
					$t=$(e.currentTarget)
		  		//加入清单
		  		var ndata=new Date().getTime().toString();   	
		  		var grn=[];//配菜
		  		if($obj.peicai.i){//如果有配菜
		  			$.each($obj.peicai.i, function(i,v) {
		  			grn.push({"garnish_id":v.garnish_id,"count":v.num,"goods_price":v.goods_price});
		  			});
		  		}
		  		// 规格ID
		  		var gID=0;
		  		if($obj.guige.i){//如果有规格
		  			gID=$obj.guige.i.spec_id
		  		}
		  		//口味ID
		  		var kID=0;
		  		if($obj.kouwei.i){//如果有规格
		  			kID=$obj.kouwei.i.taste_id
		  		}
		  		
				var cart="1"+ndata.substring(5,ndata.length-1) + Math.floor(Math.random()*1000000)
				var data={"cart_id": cart ,"member_id": getCookie("yingsoft_home_member_id"), "count":$obj.num,"goods_cate_id": $st.info.goods_cate_id, "goods_id": $st.info.id, "taste_id": kID,"spec_id": gID,"garnish_ids":grn,"status":1,"goods_price":$st.info.goods_price ,total_price: $obj.pice,"remarks": "","is_pack":0,"is_wait":0,"is_give":0,"is_old":0,"cookbook":localStorage.getItem("cookbook")};
				
				console.log(data)
				addgwc($t);
				$th.open=false;
				marry_fun(data);
		  		
		  	},
		  	martop:function(){//计算弹出层高度
		  		var shith=$("#guige_fenbu .g-box")
		  		setTimeout(function(){
		  			var sh=shith.height();
		  			shith.css({"margin-top":(0-sh/2)+"px"});
		  		},50)
		  	},
		  	close:function(){
		  		//关闭
		  		this.open=false;
		  		this.obj={};
		  	},
		  	fenbu_addnum:function(a,b){
		  		//分布配菜增加数量
		  		
			var $th_num=a.num;			
			var html1 = '<div class="peiliaoadd  fiex cf" id="peiliaoaddss" data-num="' + a.num + '">';
                html1+='<div class="p p1 fiex1"><i></i><svg class="g1" ><use xlink:href="#f_4"></use></svg></div>';
                html1+='<span class="  fiex1"><span class="g3 f-32">' + a.num + '</span></span>';
                html1+='<div class="p p2 fiex1"><i></i><svg class="g2" ><use xlink:href="#f_5"></use></svg></div>';
                html1+='</div>';

                $.modal({
                    title: a.goods_garnish_name,
                    text: "<p class='dp-1 red'>" + a.goods_price + "</p><div class='dp-2 mag-t-20 pad-b-20 pad-r-40 pad-l-40'>" + html1 + "</div>",
                    buttons: [
                      { text: "<span class='aaa'>"+ lange["1062"] +"</span>", onClick: function () {
                              b(0)//call回调     
                        }},
                      {
                          text: lange["1016"], onClick: function () {
							     b($th_num)//call回调              
                          }
                      }
                    ]
                });
				
				//数量减
				setTimeout(function(){
					var $pei=$("#peiliaoaddss")
					//console.log($pei)
					$pei.find(".p1").on("click",function(){
						if($pei.hasClass("null0")) return false;
						$th_num--;
						$pei.removeClass("null1");
						$pei.nextUntil().remove();//删除跟随元素
						if($th_num<=0) {
							$th_num=0;
							$pei.addClass("null0")
						};
						$pei.find(".g3").text($th_num);
					})
					//数量加
					$pei.find(".p2").on("click",function(){
						if($pei.hasClass("null1")) return false;
						$th_num++;
						$pei.removeClass("null0")
						if(a.maxcount){//如果有maxcount字段
							if(a.maxcount!=0 && $th_num>Math.floor(a.maxcount)){
								$th_num=Math.floor(a.maxcount);
								$pei.after('<div class="red mag-t-40 sss">'+ lange[1262] +' ['+$th_num+']</div>')
								$pei.addClass("null1")
							}
						}
						$pei.find(".g3").text($th_num);
					})
				},0)
		}
		  }
		})
		
        //end
 
           	//备注
    	$(".beizhu-bon").on("click",function(){
    		//备注模板
    		var bzs=JSON.parse(localStorage.getItem("beizhu"))
			$("#beizhu").show().html(template("beizhu-js", {"beizhu":bzs}))
			setlange_obj()//设置前端语言
			
			//设置已有备注
			var beizhup=$("#beizhu_p").text(),beit=""
			if(beizhup!=""){
			$.each(beizhup.split(","), function(i,v) {
				var sp=true;
				$("#all-beizhu .a").each(function(e,s){
					if(v==$(this).text()){
						$(this).addClass("on");
						sp=false;
						return true;
					}
				})
				if(sp){
					beit+=(v+",")
				}
			});
			if(beit!=""){
				beit=beit.substring(0,beit.length-1)
				$("#beizhuinp").val(beit)
				$("#beizhuinp").parents(".input").addClass("open");
			}
		}
			
			
			$("#all-beizhu a.st-a").on("click",function(){
				var $th=$(this);
				$th.toggleClass("on")
			})
			$("#all-beizhu .gp a").on("click",function(){
				var $th=$(this);
				$th.toggleClass("on").siblings().removeClass("on")
			})
			//手动收入备注
			$("#all-beizhu .input .bon").on("click",function(){
				var $th=$(this).parents(".input")
				$th.toggleClass("open");
				if($th.hasClass("open"))
				{
					$th.find("input").val("").focus()
				}else{
					$th.blur()
				}
			})
			
			//确定
			$("#beizhu .bon-red").on("click",function(){
				var beizhu=""
				$("#all-beizhu .a.on").each(function(i,v){
					beizhu+=$(this).text()+","
				})
				var bz=$("#beizhuinp").val()
				if(bz!="") beizhu+=bz+","
				beizhu=beizhu.substring(0,beizhu.length-1);
				$("#beizhu_p").text(beizhu)
				$("#beizhu").hide().html("")
			})
			
			//取消
			$("#beizhu .bg ,#beizhu .close1").on("click",function(){
				$("#beizhu").hide().html("")
			})
		})
    	//打开备注

        //搜索
		var searchtrue=false;
        $("#search-top").keypress(function(e){
		  if(e.keyCode === 13) {
		  	$("#search-top").blur();
		  }
		})
 		$("#search-top").blur(function(){ 		 
		   var vals=$("#search-top").val()//搜索val
		   if(vals=="") return false;
		   $("#menu-right").scrollTop(0)
		   $("#menu-left li.on").removeClass("on");
		   $("#menu-right .box,#menu-right .box .item").hide();
		   var nnn=true;
		   console.log(select_obj)
 			$.each(select_obj, function(i,v) {
		   	  if(v.id!=1 && v.id!=2 && v.id!=0){
		   	  	$.each(v.goods_list, function(ii,vv) {		   	  		
		   	  		var nam=vv.goods_name.toLowerCase(),
		   	  			sn=vv.sn.toLowerCase();
		   	  			console.log(nam,vals.toLowerCase())
			   		if(nam.indexOf(vals.toLowerCase()) != -1||sn.indexOf(vals.toLowerCase())!=-1){
			   			nnn=false;
			   			$("#main-right-box-"+vv.goods_cate_id).show().find(".item-"+ vv.id).show();
			   		}
			   	});
		   	  }			   
		   });
		   if(nnn) {
		   	$("#nulldata").show()
		   }else{
		   	$("#nulldata").hide()
		   }
		   searchtrue=true;
 		})
		//end
        
        
        
        //获取当前菜谱
        var cookbookid=localStorage.getItem("cookbook"),
        	setmenumore=localStorage.getItem("setmenumore"),//是否多菜谱
        	getcookmenu=JSON.parse(localStorage.getItem("cookbook_list"))
        	//排序
			function sortId(a,b){  
				if(b.time_is==a.time_is && b.is_table==a.is_table && b.is_select!=a.is_select){
					return b.is_select-a.is_select
				}else if(b.time_is==a.time_is && b.is_table!=a.is_table && b.is_select==a.is_select){
					return b.is_table-a.is_table
				}else if(b.time_is!=a.time_is && b.is_table==a.is_table && b.is_select==a.is_select){
					return b.time_is-=a.time_is
				} 
		    }
			getcookmenu.sort(sortId);
        //设置头部菜谱切换
        if(setmenumore=="1"){
        	
        	$("#caipu_top").html(template("menu-top", {list:getcookmenu,cur:cookbookid}));
        	$("#menu-left,#menu-right").css("top","0.8rem")
        	$("#qiehuan_prve").css("top","0")
        }else{
        	$(".caipu_top_box").hide();//隐藏菜谱选择
        	$("#menu-left").css("top","0")
        }
        //点击切换
        $("#caipu_top").find("a").on("click",function(){
        	var $th=$(this);
        	
        	if($th.hasClass("on"))  return false;
        	$th.addClass("on").siblings().removeClass("on");
        	
			localStorage.setItem("cookbook",$th.data("cookbook"))
			cookbookid=localStorage.getItem("cookbook")
			getcookid=cookbookid;
         	defaultfun();
         	
        })
        
        
        //设置gps距离
        var setkm="",gps1="",
        	setjunli=true;//判断距离是否可以点餐



		//下单
		$("#xiachu").on("click", function () {	
			console.log(!setjunli)
			if(!setjunli){
			 $.modal({
                title: lange["1124"],
                text: "<span class='c666'>"+lange["1200"]+"</span>",
                buttons: [
                  { text: "OK", onClick: function () {
                  	
                  }}
                 ]
             });
             return false;
			}
			
		   var ts1="",//提示内容
		   	   ts2="",//按钮1
		   	   ts3="",//按钮2
		   	   ts_prop=""
		   //选择人数
		   if(!(localStorage.getItem("pax")>0)){
		   		ts_prop+="<div class='xuanzeprop' id='xuanzeprop'><div class='mag-t-20 center tit1' ><span data-l='1149'></span></div>"
		   		ts_prop+="<div class='cf list'>";
		   		for(var s=1;s<11;s++){
		   			ts_prop+="<span><i>"+s+"</i></span>";
		   		}
		   		ts_prop+="<span class='oth'><input type='number' data-p='1150' /></span>";	
		   		ts_prop+="</div></div>";		   		
		   }
		   //
		   
		   if(cart_obj.th_number==0){
 			  ts1=lange["1121"]+ts_prop,
		   	  ts2=lange["1017"],
		   	  ts3=lange["1016"];
		   }else{
		   	  ts1=lange["1119"]+ts_prop,
		   	  ts2=lange["1120"],
		   	  ts3=lange["1121"];
		   }
		   //是否有其他用户
//		   if(getCookie("other")!="null"){
//			   
//		   }else{
//		   	  ts1=lange["1121"]+ts_prop,
//		   	  ts2=lange["1017"],
//		   	  ts3=lange["1016"];
//		   }
		  
		   //下单提示
		   $.modal({
                title: lange["1124"],
                text: "<span class='c666'>"+ts1+"</span>",
                buttons: [
                  { text: "<span class='aaa'>"+ ts2 +"</span>", onClick: function () {}},
                  {
                      text: ts3, onClick: function () {
                    
                       var beizhu=$("#beizhu_p").text();						
					   var pack=$("#other_set0_2").prop("checked")?1:0;	
					  
					  //设置定位
					  //alert(getCookie("gps"))	
					  
					  var newtjiao = [];
					    $.each(cart_obj.my_list[getCookie("yingsoft_home_member_id")], function (i, v) {
					    	//如果不是多菜谱只提交当前菜谱数据
					    	 if(localStorage.getItem("setmenumore")!="1"){
					    	 	if(v.cookbook==cart_obj.curcookbook){
					    	 		newtjiao.push(v);
					    	 	}
					    	 }else{
					    	 	newtjiao.push(v);
					    	 }
					    })
					    if(newtjiao.length==0) return false;
						
						//localStorage.removeItem("cart_obj");
						
						global_ajax(jsonpath + "put_shop_order_confirm", { "remarks": beizhu,"is_pack":pack ,"cookbook_id": cookbookid,"pax":pxas,"gps":gps1,"distance":setkm,"shop_table_id": localStorage.getItem("shop_table_id"),"goods_list":newtjiao}, function (e) {
						if(e.status==1){
		  			 		localStorage.removeItem("cart_obj")
						 //
						  if(!(localStorage.getItem("pax")>0)) {
						  	localStorage.setItem("pax",pxas);
						  }
						  
						  if(e.status==1) {
						  	localStorage.setItem("finish_gg",JSON.stringify(e.result));
						  }
						 
			              Q.go("finish-html?point="+e.result.point)
		  			 	}else{
		  			 		$.alert(e.msg)
		  			 	}

			        })                       
                      }
                  }
                ]
            });
		   setlange_obj()//设置前端语言
		   //
		   var pxas=localStorage.getItem("pax")//设置人数
		   var queding=$(".weui-dialog__ft .weui-dialog__btn:last-child")
		   if(localStorage.getItem("pax")==0) queding.addClass("null")//禁用确定按钮
		   queding.on("click",function(){
		   		if($(this).hasClass("null")){
		   			$("#xuanzeprop .tit1").addClass("tips")
		   		}
		   })
		   
		   //选择人数设置
		   $("#xuanzeprop span i").on("click",function(){
		   	 var p=$(this).parent();
		   	 	 p.addClass("on").siblings().removeClass("on");
		   	 	 pxas=$(this).text();
		   	 	$("#xuanzeprop input").val("");
		   	 	 queding.removeClass("null")
		   })
		   $("#xuanzeprop input").on("focus",function(){
		   		 var p=$(this).parent();
		   	 	 p.addClass("on").siblings().removeClass("on");		   	 	 
		   	 	 queding.removeClass("null");
		   })
		   $("#xuanzeprop input").on("blur",function(){
		   		 var p=$(this).val();
		   	 	 if(p>0){
		   	 	 	pxas=$(this).val();
		   	 	 }else{
		   	 	 	$("#xuanzeprop input").val("");
		   	 	 	$(this).parent().removeClass("on");
		   	 	 	 queding.addClass("null")
		   	 	 }
		   })
		   //设置最大人数99；
		   $("#xuanzeprop input").on("input propertychange",function(){
		   		 var p=$(this).val();
		   		 if(p>=99){
		   		 	$(this).val(99);
		   		 }
		    })
		   //
		   
		})
        
        //$(".test0001").remove();
        //$("body").append('<div class="test0001" style="position:fixed; z-index:100000000000; left:0; bottom:0; background:#000; color:#fff; font-size:12px; padding:5px;">程序调试：' + getCookie("yingsoft_home_member_id") + '</div>')
        //设置语言
		var guqing_obj={}
        var defaultfun = function () {
            //
            if(localStorage.getItem("key1")!=null){
            	var ss=JSON.parse(localStorage.getItem("key1"));
            	global_ajax(jsonpath + "get_shop_goods_status_list", '', function (e) {
					guqing_obj=e.result;
					setlist(ss);
	                setselect_item();
				})
            	
            }else
            {
            	
           var setlangua=getCookie("language")

           $.ajax({
	        type: "get",
	        dataType: "json",      
        	timeout : 20000, 
	        url: oss+"/shop_goods/"+ getCookie("shopid") +"_"+setlangua+".json",
	        cache: false,
	        success: function (e) {
	        	 //设置返回值
		               localStorage.setItem("key1", JSON.stringify(e))
		               
		               var key2={},key3={},key4={},key5={};
		               $.each(e.result.list,function(i,v){
		               		if(v.id==1||v.id==2){}else{
		               			$.each(v.goods_list,function(ii,vv){               				
		               				key2[vv.id]=vv;		               				
		               			})               			
		               		}
		               });
		               $.each(e.result.spec_list,function(iii,vvv){
           					key3[vvv.spec_id]=vvv;
           				})
           				$.each(e.result.taste_list,function(iii,vvv){
           					key4[vvv.taste_id]=vvv;
           				})
           				$.each(e.result.garnish_list,function(iii,vvv){
           					key5[vvv.garnish_id]=vvv;
           				})
		               
					  //设置菜品
					   localStorage.setItem("key2", JSON.stringify(key2))
					   localStorage.setItem("key3", JSON.stringify(key3))
					   localStorage.setItem("key4", JSON.stringify(key4))
					   localStorage.setItem("key5", JSON.stringify(key5))
					   caidan_json=key2;
					   guige1_json=key3;
					   kouwei1_json=key4;
					   peicai_json=key5;
	            		
	            	var ss=e;
	            	global_ajax(jsonpath + "get_shop_goods_status_list", '', function (e) {						
						guqing_obj=e.result;
						setlist(ss);
		                setselect_item();
					})
	            	
	            		
	        },
	        error: function () {
		            $.modal({
			          title: "tips",
			          text: "Loading error",
			          buttons: [
			            { text: "Refresh", onClick: function(){
			            	window.history.go(-1);
			            	location.reload(true)  
			            } }
			          ]
			       });
	        }
	       })

           
	        }            
            //
        };
        
        var getcookid=cookbookid;
        //设置当前菜单是否可用
    	var menuobj=JSON.parse(localStorage.getItem("cookbook_list")),
    		curmenu=getjsons(menuobj,getcookid,"id");

        var setlist=function(e){
        	
        	///初始设置套餐数据
        	if(e.result.package_list){//判断是否有套餐字段
				if(e.result.package_list.length){//判断是否添加了套餐
					var push={
						goods_cate_name: "套餐",
						hide:0,
						id:0,
						lefttime:1,
						goods_list:[]
					}
					$.each(e.result.package_list,function(i,v){
						v["goods_cate_id"]='0';
						v["is_package_goods"]='1';//套餐标识
						push.goods_list.push(v);
						console.log(v)
					})
					if(e.result.list[2].id==0){
						e.result.list.splice(2,1,push)
					}else{
						e.result.list.splice(2,0,push)
					};//如果已存套餐 就替换 不存在 插入
				}
				//
			}
			console.log(e)
			console.log(guqing_obj)
        	//end
        	
        	
        	//设置菜谱是否可用
        	curmenu=getjsons(menuobj,getcookid,"id")    ;
    		console.log(curmenu)
    		if(curmenu.time_is==0 || curmenu.is_table==0 || curmenu.is_select==0 ){
    			$("#select-buy").hide()
    			$("#select-buy1").show();
    			var il=0;
    			if(curmenu.is_select==0){
    				il=1201;
    			}else{
    				if(curmenu.time_is==0){
    					il=1148;
    				}else if(curmenu.is_table==0){
    					il=1194;
    				}
    			}
    			console.log(curmenu)
    			console.log(il)
    			var ht="<span>"+ lange[1202] +"</span>&nbsp;&nbsp;&nbsp;&nbsp;<span>"+ lange[il] +"</span>";
    			$("#select-buy1").find("p").html(ht)
    			
    		}else{
    			$("#select-buy").show()
    			$("#select-buy1").hide()
    		}
        	
        	
        	select_obj = e.result.list;
               
               var stlist1=e.result
                //设置估清菜品              
                 //console.log(stlist1.list)  
                 
                 //判断分类时间状态
                 var leftarrtime={}
                  $.each(stlist1.list, function(ii,vv) {
	                  	//判断分类时间是否可用
	                	var lefttime=0;
						if(vv.begin_time>0 && vv.end_time>0 && !lefttime){					
		            		lefttime=rettime1(vv.begin_time,vv.end_time,vartime);
		            		//console.log(1,lefttime);
		            		if(vv.begin_time1>0 && vv.end_time1>0 && !lefttime){            			
		            			lefttime=rettime1(vv.begin_time1,vv.end_time1,vartime);  
		            			//console.log(2,lefttime);
		            			if(vv.begin_time2>0 && vv.end_time2>0 && !lefttime){            				
		            				lefttime=rettime1(vv.begin_time2,vv.end_time2,vartime);
		            				//console.log(3,lefttime);
		            			}
		            		}
		            	}else{
		            		lefttime=1;
		            	}
		            	//console.log(time_is)
		            	if(lefttime==1){
		            		//console.log(vv.week)
		                	if(vv.week!="" && vv.week!=undefined){
		                		var nwerk=new Date();
		    					nwerk.setTime(vartime*1000);
		    					var mwk=vv.week,
		    						gw=getweek(nwerk);
		    					if(mwk.indexOf(getweek(nwerk))==-1){
		    						lefttime=0;
		    					}
		                	}else{
		                		lefttime=1;
		                	}
		            	}
		            	vv.lefttime=lefttime;
		            	
		            	leftarrtime[vv.id]=lefttime;
                  })
                 //end 判断分类时间是否可用
                 
                 
            	 $.each(stlist1.list, function(ii,vv) {
                	var lefthide=true;//判断是否左侧栏目隐藏——菜谱
                	var lefthidetime=true;//判断是否左侧栏目隐藏——时间
                	var leffhide_2=true;//判断是否左侧栏目隐藏——估清
                	
                	vv.hide=1;
                	var huizong=false;
	                $.each(vv.goods_list, function(i,v) {
	                	//设置菜单
	                	var righthide=true;//判断是否左侧栏目隐藏

	                	//判断分类时间是否可售	                	
	                	if(leftarrtime[v.goods_cate_id]==1){
	                		lefthidetime=false;
	                		v.lefttime=1;	                		
	                	}else{
	                		v.lefttime=0;
	                		
	                	}
	                	//end判断分类
	                	
	                	//判断菜谱
	                	$.each(v.cookbook_id,function(ci,cv){
	                		if(cv==getcookid){	                		 
	                		  lefthide=false;
	                		  righthide=false
	                		  return false;	
	                		}
	                	})
	                	if(v.cookbook_id.length==0){
	                		 lefthide=false;
	                		 righthide=false
	                	}
	                	//如果菜谱没有菜品隐藏
	                	if(righthide){
		            		v.hide=1;
		            	}else{
		            		v.hide=0;
		            	}
		            	//end菜谱
		            	if(v.is_package_goods){
		            		if(v.is_package_goods!='1') v.hide=1;
		            	}
		            	if(v.is_member_hide){
		            		if(v.is_member_hide!='0') v.hide=1;
		            	}
		            	//
		            	
		            	//console.log(v.goods_name,guqing_obj.list[v.id])
		            	
	                	//设置是否估清菜品
	                	
			   			if(guqing_obj.list[v.id]!=undefined)
	            		{
	            			leffhide_2=false;
	            			if(v.status!="99"){
	            				v.status=2;
	            			}
	            		}else
	            		{	  
	            			if(v.status!="99"){
	            				v.status=1;
	            			}
	            		}
	            		
	            		if(v.is_package_goods==1 && v.status!="99"){//等于2 是套餐设置估清
	            			v.status=guqing_obj.package_list[v.id]?2:1;
			        	}
	            		//end估清
	            		
	            		//判断三种状态是否都通过了现在左侧，status=估清、hide=菜谱、lefttime=分类时间
	            		if(v.status==1 && v.hide==0 && v.lefttime==1){
	            		  	huizong=true;
	            		}
	            		//end
	            	});
	            	
	            	
	            	//end
	            	//三种状态是否都通过,显示左侧栏目
	            	if(huizong) vv.hide=0;
	            	
            	});
            	console.log(stlist1)
            	//返回时分秒时间戳字符串字符串
            	function time1(s){
            		var nn=new Date();
					nn.setTime(s*1000) ;               	
					return nn.format("hhmmss");
            	}
            	//判断是否设置了时间
            	function rettime1(s,d,c){
            		var time_is=1;
                	var beg=time1(s),//开始
                		end=time1(d),//结束
                		cur=time1(c);//当前	
                		//console.log(beg , cur, end)
                	if(end>beg){
                		//如果结束时间大于开始时间
                		if(beg < cur && end > cur){
                			time_is=1;
                		}else{
                			time_is=0
                		}
                		
                	}else{
                		//隔天
                		if(beg > cur && end < cur){
                			time_is=1;
                		}else{
                			time_is=0;
                		}
                	} 
                	return time_is;            		
            	}
            	//end
            	var nnn=1;
            	if(curmenu.time_is==0 || curmenu.is_table==0 || curmenu.is_select==0 ){
            		nnn=0
            	}
            	
            	stlist1["menu"]=nnn;
            	stlist1["oss"]=ossroot;
                console.log(stlist1.list)
                
     
                stlist1["shouqin"]=lange[1368]
                $("#menu-right").html(template("menu-right-js", stlist1));
                $("#menu-left").html(template("menu-left-js", stlist1));
				
				 //设置盒子高度
                $(".menu-btm").css("max-height", $(window).height() - $("#select-buy").height() - $(".titles").height())
				
                setlange_obj()//设置前端语言
				
				 //滚动定位
                var mr = $("#menu-right"),
                	ml = $("#menu-left"),
                	mllist = $("#menu-left li"),
                	mlheight=ml.height(),
                	mlscroll=ml.find("ul").height()+$(".bank100").height(),
                	mrh=mr.height(),
                	mrh_wh=$("#menu-right-w").height();
                	onindex=0;//默认索引值
                 //滚动元素
               var scroll_prve=$("#qiehuan_prve"),
               	   scroll_next=$("#qiehuan_next");
                //设置定位
                var mllength= ml.find("li").length;
                // 简单的节流函数
                var startX = startY = endX =endY =0;
                var xxia=0,chufa_x=0;
                var xshang=0,chufa_s=0;
                ml.find("li").click(function () {
                    var $th = $(this),
                        id = $th.data("id"),
                        $index=$th.index();
                        
                    var tp = $th.position().top,
                        stp = ml.scrollTop();
			

                    $("#main-right-box-" + id).show().siblings().hide();
                    $(this).addClass("on").siblings().removeClass("on")
                    //搜索后点击
                    if(searchtrue){
                    	searchtrue=false;
                    	$("#menu-right .item").show();
                    	$("#search-top").val("")
                    }
                    mrh_wh=$("#menu-right-w").height();
                    setscrolltop();
                    mr.scrollTop(0);
                    
                    //是否是第一和最后
                    scroll_prve.removeClass("end")
                    scroll_next.removeClass("end")
                    if($index==0){
                    	scroll_prve.addClass("end")
                    }
                    //console.log($index,mllength)
                    if($index==mllength-1){
                    	scroll_next.addClass("end")
                    }
                    
                })
				ml.find("li").eq(0).addClass("on").click();
				
                
                
                
                mr.off("touchstart")
			    mr.on('touchstart',function(event){
			     if(searchtrue) return true;//如果是搜索
			      var touch = event.targetTouches[0];
			      
			      //多点触控返回
			      var touches = event.targetTouches;
			      if(touches.length>1) return false;
			      //滑动起点的坐标
			      startX = touch.pageX;
			      startY = touch.pageY;
			      // console.log("startX:"+startX+","+"startY:"+startY);
			      //如果top=0 准备切换上一页
			      
			     // console.log(xxia)
			      console.log(xshang,xxia)
			      if(xxia){
			      	chufa_x=1;//如果滚动已经在底部则添加触发事件
			      }else{
			      	chufa_x=0;
			      }
			      if(xshang){
			      	chufa_s=1;//如果滚动已经在顶部
			      }else{
			      	chufa_s=0;
			      }
			      
			    });
			    mr.off("touchmove")
			    mr.on("touchmove",function(event){
			    	if(searchtrue) return true;//如果是搜索
			      var touch = event.targetTouches[0];
			      //多点触控返回
			      var touches = event.targetTouches;
			      if(touches.length>1) return false;
			      //手势滑动时，手势坐标不断变化，取最后一点的坐标为最终的终点坐标
			        endX = touch.pageX;
			        endY = touch.pageY;
			        // console.log("endX:"+endX+","+"endY:"+endY);
			       // console.log(startY,endY)
			       var sts=0-((startY-endY)/3);
			        if(sts>100) sts=100;
			        if(sts<-100) sts=-100;
			        if(startY>endY){
			        	if(xshang && chufa_s){
			        		mr[0].style.WebkitTransform="translate(0,"+ sts+"px)";
				        	scroll_next[0].style.WebkitTransform="translate(0,"+ sts+"px)";
				        	if(sts<-45) scroll_next.addClass("ov")
							event.preventDefault();
				        }
			        }else{
			        	if(xxia && chufa_x){
			        		mr[0].style.WebkitTransform="translate(0,"+ sts+"px)";
				        	scroll_prve[0].style.WebkitTransform="translate(0,"+ sts+"px)";
				        	if(sts>45) scroll_prve.addClass("ov")
				        	event.preventDefault();
				        }
			        }
			        
			        
			    })
			    mr.off("touchend")
			    mr.on("touchend",function(event){
			    	if(searchtrue) return true;//如果是搜索
			      var distanceX=endX-startX,
			        distanceY=endY - startY;
			        //多点触控返回
			      var touches = event.targetTouches;
			      if(touches.length>1) return false;
			        // console.log("distanceX:"+distanceX+","+"distanceY:"+distanceY);
			        
			        //移动端设备的屏幕宽度
			        //判断是否滑动了，而不是屏幕上单击了
			        if(startY!=Math.abs(distanceY)){
			 			//在滑动的距离超过屏幕高度的20%时，做某种操作
				        if(Math.abs(distanceY)>30){
				 				//向下滑实行函数someAction1，向上滑实行函数someAction2
					 			if(distanceY <0){
					 				if(xshang && chufa_s){
					 					console.log("切换上一页")
					 					//切换下一页
					 					console.log(scroll_next)
					 					if(scroll_next.hasClass("ov")){
					 						ml.find(".on").next().click()
					 						chufa_s=0;
				 						}
					 				}else{
					 					console.log("准备切换上")
					 				}
					 				//.click();
					 			}else{
					 				console.log(mr.scrollTop());
					 				if(xxia && chufa_x){
				 						console.log("切换下一页");
				 						//切换下一页
				 						if(scroll_prve.hasClass("ov")){
					 						ml.find(".on").prev().click()
				 							chufa_x=0;
				 						}
				 						
				 					}else{
				 						console.log("准备切换下");
				 					}
					 			}
					    }
			        }
			        startX = startY = endX =endY =0;
			    
			    	mr[0].style.WebkitTransform="translate(0,0)";
			        scroll_prve[0].style.WebkitTransform="translate(0,0)";
			        scroll_next[0].style.WebkitTransform="translate(0,0)";
			        scroll_prve.removeClass("ov")
			        scroll_next.removeClass("ov")
			    })
				mr.scroll(function(){
					setscrolltop();
				});
			    function setscrolltop(){
			    	var $stop=mr.scrollTop();
					//console.log($stop)
					//console.log(mrh_wh,mrh)
					if(mrh_wh>mrh){
						if($stop<=0){
							xxia=1;
						}else{
							xxia=0;
						}
						if($stop+mrh>=mrh_wh-10){
							xshang=1;
						}else{
							xshang=0;
						}
					}else{
						xxia=1;
						xshang=1;
					}
					
			    }
			    
			    
				// 实际想绑定在 scroll 事件上的 handler
				function realFunc(){					
				    var st = mr.scrollTop(),
                    	lt1=ml.scrollTop(),
                    	th1=$(".title").height(),
                    	wh=$(window).height()-$("#select-buy").height()-th1,
                    	ont=$("#menu-left .on").offset().top;
      
                    mr.find(".box").each(function (e) {
                        var $th = $(this),
                            $h = $(this).height(),
                            $t = $(this).position().top;
                        if ($t <= 0 && $t + $h > 0) {
                            $("#menuleft-" + $th.data("id")).addClass("on").siblings().removeClass("on");                            
                        }
                    })
                    var onsind=$("#menu-left li.on").index()
                   
                    if(mlheight<mlscroll){
                    	if(onindex!=onsind)
                    	{
                    		var sx=mlscroll-mlheight,
                    			l=mllist.length;
                    			ml.animate({scrollTop:sx*(onsind/l)},200);                    		
                    	}
                    }
                    onindex=onsind;
				}
                //realFunc()

				
        }
        
        //全部打包
        $("#other_set0_2").click(function(){
        	var  $list=$("#my-list"),
        		 $th=$(this),
        		 $json=cart_obj.my_list[getCookie("yingsoft_home_member_id")],
        		 $pak=0;
        	//全部
    		$list.find(".item-l .td5").each(function(){
    			var $td5=$(this);
    			//console.log($th.prop("checked"))
    			if($th.prop("checked")){ 
    				//console.log($td5)
    				$td5.addClass("on")
    			}else{
    				$td5.removeClass("on")
    			}	
    		});
    		
    		$.each(cart_obj.my_list[getCookie("yingsoft_home_member_id")], function(i,v) {
    			v.is_pack=1
    		});
    		
    		//全部打包接口
    		$th.prop("checked")?$pak=1:$pak=0; 
    		//设置已选菜品缓存
	        localStorage.setItem("cart_obj",JSON.stringify(cart_obj))
	        
//			global_ajax(jsonpath + "edit_cart_pack_all", {"is_pack": $pak }, function (e) {
//	       		console.log(1);
//	    	})
        	
        })
	
		//清空全部
	    $(".carbuy .car-tit .fr").click(function () {
	            //delete_cart
	            $.modal({
	                title: lange['1015'],
	                text: lange['1014'],
	                buttons: [
	                  { text: lange['1017'], className: "default" },
	                  {
	                      text: lange['1016'], onClick: function () {
	                      	
	        				//如果多菜谱移除全部不是多菜谱移除当前菜单
							if(localStorage.getItem("setmenumore")!="1"){
							 	var arr=cart_obj.my_list[getCookie("yingsoft_home_member_id")],
							 		ii=arr.length
							 	 while(ii--){
							 	 	console.log(arr[ii].cookbook,cart_obj.curcookbook)
									 if(arr[ii].cookbook==cart_obj.curcookbook){
									  arr.splice(ii,1);
									 }
								 }
							 	 localStorage.setItem("cart_obj",JSON.stringify(cart_obj))
					    	}else{
					    	 	localStorage.removeItem("cart_obj")
					    	}
	        				
	        				
	                      	setselect_item();
					                //console.log(123123)
					        $(".select-menu").removeClass("open-gwc");
					        
					        
	                      }
	                  }
	                ]
	            });
	        });
        
        var setselect_item=function(){
	        	//初始化已选数据
		        var getitms=localStorage.getItem("cart_obj")
		        //设置桌号
		        $(".title1").text(localStorage.getItem("shop_table_name"));
		        if(getitms!=null){
		        	cart_obj=JSON.parse(getitms)
		        	marry_fun();
		        }else{	
		        	cart_obj = {
		                	"total_money":0,
		                	"my_number": 0,
		                	"th_number": 0,
		                	"open_other":false,
		                    "member_id": getCookie("yingsoft_home_member_id"),
		                    "my_list": {},
		                    "cart_id_list": {},
		                    "order_info":{}
		                }
		                
		        }
		        marry_fun();
	        }
            
	    //更新数据
		function setaddss(data1){
				var ss=data1;   
				
				console.log(data1)
				if(ss.is_package_goods!=1){
					 var name1 = caidan_json[ss.goods_id].goods_name,
	            	guige = ss.spec_id!=0 ? guige1_json[ss.spec_id].goods_spec_name :null,
		            kouwei = ss.taste_id!=0 ? kouwei1_json[ss.taste_id].goods_taste_name:null;
	            	ss["goods_name"]=name1;
	            	ss["goods_spec_name"]=guige;
	            	ss["goods_taste_name"]=kouwei;
	            	if(!!ss.garnish_ids){
		            	$.each(ss.garnish_ids, function (ii, vv) {
		            		var name2 = peicai_json[vv.garnish_id].goods_garnish_name;
		            		vv["goods_garnish_name"]=name2;
		            	});
	            	}
				}
	            	
            	return ss;
		}
			
        //匹配以选择数据
        var marry_fun = function (data) {
			//处理新插入的数据
			var newd1=true//是否新增数据
			
			if (data!=undefined)
            {
            	var data1 = data,
            	slist=cart_obj.my_list[data1.member_id];            	
 				if(slist!=undefined)
 				{
 					
 					var sss=getjsons(slist,data1.cart_id,'cart_id'),
 						sssid=getindex(slist,data1.cart_id,'cart_id')
            		if(sss.cart_id!=undefined)
 					{
	 					newd1=false;
	 					
						if(data1.count==0){
							//删除数据
						
							var ojs1=$("#menu-right .item-"+ data1.goods_id);
							if(ojs1.find(".addright").attr("data-num")==1){
								ojs1.find(".g3").text(0);
								ojs1.find(".addright").attr("data-num", 0);
								ojs1.removeClass("add")
							}
							
							//$("#menu-right .item[data-id="+ data1.goods_id +"] .g3").text(0);
			    			//$("#menu-right .item .addright").attr("data-num", 0);
							cart_obj.my_list[getCookie("yingsoft_home_member_id")].splice(sssid,1)
			
						}else{
							slist[sssid]=setaddss(data1)//更新数量
							//console.log(slist[sssid])
							//更新界面							
							//myobj.find(".addright").attr("data-num", data1.count);
							//myobj.find(".addright").find(".g3").text(data1.count);
						}
					}
					
 				}
 				//判断是否新增数据
 				if(newd1){                    	
                    //添加名称 规格名称   
		                if(!!!cart_obj.my_list[setaddss(data1).member_id]) cart_obj.my_list[setaddss(data1).member_id]=[];		                
                    	cart_obj.my_list[setaddss(data1).member_id].push(setaddss(data1))
 				}
            	//更新界面数字状态；
            }
			//i
			
	        //购物车列表
	    	$(".menu-left li i,#select-buy .left .gw i,#select-buy .left .gw em").text("");
	    	$("a i","#caipu_top").hide().text("");
	    	var objs=$("#menu-right .item"),
				nums=objs.find(".addright").attr("data-num",0);
		    	cart_obj.th_number=0;
		    	cart_obj.my_number=0;
		    	cart_obj.total_money=0;
		        $.each(cart_obj.my_list, function (ii, vv) {
	                	 //判断是否有其他用户
	                	if(cart_obj.member_id != ii){

	                	}else{
	                		var mright=$("#menu-right")
	                		$.each(vv, function (i, v) {
	                			
	                			//如果不是多菜谱而且菜谱ID也不相同 跳出累加
	                			if(localStorage.getItem("setmenumore")!="1" && v.cookbook!=getcookid){
	                				return true;
	                			}
	                			
	                			if(v.status==1){
	                				//设置数量
			                		cart_obj.my_number += Number(v.count);
			                		//左侧分类列表
				                    var cate_id = $("i","#menuleft-" + v.goods_cate_id).text();
				                    cate_id = cate_id != '' ? cate_id : 0
				                    var ss = 0;
				                    if(v.cookbook==getcookid){
				                    	ss=accAdd(cate_id, v.count)
				                    }else{
				                    	ss=accAdd(cate_id, 0)
				                    }
				                    if (ss > 0) {
				                        $("i","#menuleft-" + v.goods_cate_id).text(ss);
				                    }
				                    
				                    
				                    
				                    //菜单数字
				                    var caipu_id = $("i","#caipu_" + v.cookbook).text();
				                    caipu_id = caipu_id != '' ? caipu_id : 0;
				                    var ss1 = accAdd(caipu_id, v.count);
	
				                    if (ss1 > 0) {
				                        $("i","#caipu_" + v.cookbook).text(ss1).show();
				                    }else{
				                    	$("i","#caipu_" + v.cookbook).hide()
				                    }
				                    
				                    //设置总价
				                    cart_obj.total_money = accAdd(cart_obj.total_money, v.total_price)
				                    
				                    //右侧菜列表
				                      if(v.member_id==cart_obj.member_id && v.cookbook==getcookid)
					                  {
				                    	  var objs=mright.find(".item-" + v.goods_id),
					                      nums=objs.find(".addright").attr("data-num");
						                  if(v.count > 0) {
						                  	objs.addClass("add")
						                  }
						                  objs.find(".g3").text(accAdd(v.count,nums));
						                  objs.find(".addright").attr("data-num", accAdd(v.count,nums));
						                  objs.find(".addright").attr("data-cart_id", v.cart_id);
					                  }	
			                   }
		                   
	                		})
	                	}
	                	//总价
	                	
		        })
		        
	        //格式化金额
	        cart_obj.total_money=toFixed2(cart_obj.total_money, 2)
	        $("#total_price span").text(cart_obj.total_money);
	        
	        //清空数据调用
	        if (cart_obj.my_number == 0 && cart_obj.th_number == 0) {
	        	$("#menu-right .item").removeClass("add")
	        	$(".select-menu").removeClass("open-gwc");
	        	$("#select-buy").removeClass("open");
	        	$("a i","#caipu_top").hide().text("0")
	        	$("#menu-right .item .g3").text(0);
			    $("#menu-right .item .addright").attr("data-num", 0);
	        } 
            if (cart_obj.my_number > 0) {
                $("#select-buy").addClass("open");
                $("#select-buy .left .gw i").text(cart_obj.my_number);
            }
            if (cart_obj.th_number > 0) {
            	$(".car-box").removeClass("open-otehr"); 
                $("#select-buy").addClass("open");
                $("#select-buy .left .gw em").text(cart_obj.th_number);
            }else{
            	$(".car-box").addClass("open-otehr"); 
            }
	        //
	        //console.log(cart_obj)
	        
	        //是否多菜谱
	        cart_obj["setmenumore"]=localStorage.getItem("setmenumore");
	        //当前菜谱id
	        cart_obj["curcookbook"]=localStorage.getItem("cookbook");
	        
	        //只有添加新数据才更新模板
	        
	        
	        cart_obj['caidan_json']=caidan_json
			cart_obj['guige1_json']=guige1_json
			cart_obj['kouwei1_json']=kouwei1_json
			cart_obj['peicai_json']=peicai_json
	        
	        $("#my-list").html(template("select-buy-js1", cart_obj));
            $("#other-list").html(template("select-buy-js2", cart_obj));
            
            //单独打包
			 $(".item-l .td5","#my-list").click(function () {

			 	var $th=$(this),
			 		$p=$th.parents(".item-l"),
			 		$ind=$p.index(),
			 		$id=$p.attr("data-cart_id"),
			 		$pak=0;
			 		$th.toggleClass("on");
			 		if($th.hasClass("on")){
			 			$pak=1;
			 		}else{
			 			$pak=0;
			 		}
			 	
			 	cart_obj.my_list[getCookie("yingsoft_home_member_id")][$ind].is_pack=$pak;
//				global_ajax(jsonpath + "edit_cart_pack", {"cart_id": $id,"is_pack": $pak }, function (e) {
//		       		
//		    	})
				
				//判断是否全部清除打包状态
				var  $list=$("#my-list"),
					 $chk=$("#other_set0_2"),
					 $leng=cart_obj.my_list[getCookie("yingsoft_home_member_id")].length,
					 $listleng=$list.find(".item-l .td5.on").length;
				
				if($listleng==$leng){
					$chk.prop("checked",true)
				}else{
					$chk.prop("checked",false)
				}
				
				   //设置已选菜品缓存
	        	localStorage.setItem("cart_obj",JSON.stringify(cart_obj))
			 })
            
			$(".car-box .addright .p2,.car-box .addright .p1").on("click", function (e) {
				e.stopPropagation();
				e.preventDefault();
				setClick($(this),true)
			});
			
	        setlange_obj()//设置前端语言
	        
	        
	        //设置已选菜品缓存
	        console.log(cart_obj)
	        localStorage.setItem("cart_obj",JSON.stringify(cart_obj))

        }

 		defaultfun()
    </script>

</div>
</div>